我试图将Spring Integration与Amazon SQS结合使用,但无法弄清楚我做错了什么。
如果我使用如下的内存中队列,一切正常:
<channel id="businessEvents">
<queue />
</channel>
但当我将其更改为使用AWS SQS时如下:
<int-sqs:channel id="businessEvents"
region-id="us-east-1"
queue-name="events-sqs"
aws-credentials-provider="awsCredentialsProvider" />
我收到以下错误:
org.springframework.integration.MessagingException: org.springframework.integration.MessagingException:没有序列化程序 找到类br.com.event.RegisterEvent并没有属性 发现创建BeanSerializer(以避免异常,禁用 SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS))(通过引用 chain:org.springframework.integration.aws。[&#34; payload&#34;])
我是否需要在Spring Integration上配置其他任何内容?或者我的bean类出了什么问题?
答案 0 :(得分:0)
SerializationConfig.Feature ...
看起来你在某种程度上调用了JSON序列化(杰克逊),你的班级不是杰克逊友好的。
在提出这样的问题时,请显示完整的堆栈跟踪。
答案 1 :(得分:0)
想出来了。我们用@JsonProperty注释我们的事件(进入队列),如下所示:
@com.fasterxml.jackson.annotation.JsonProperty
private long createdAt;
但是当我们使用String Integration AWS时,我们需要使用另一个包中的@JsonProperty。
@org.codehaus.jackson.annotate.JsonProperty
private long createdAt;