Replies: 1 comment
-
Hi @lyoumi,
The reason you're seeing this behavior is that the framework needs to know what type to deserialize the payload into before it reaches your listener method. By default, it does this by including the type in the headers, but since that behavior was disabled, you’ll need to provide a strategy via the setPayloadTypeMapper method. Once you configure that properly, you'll still get type-safe deserialization based on your generic type. Let me know if that works for you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Used framework versions:
spring-cloud-aws-starter-sqs: 3.3.0
spring-boot: 3.4.5
Spring sqs config:
`
CustomMessageInterceptor implements MessageInterceptor specifying generic type (implements MessageInterceptor<CustomDtoContainer>).
Issue comes in override intercept method: I do call message.getPayload().getCustomDto() and failing because of getPayload returns String and I cannot cast String to CustomDtoContainer
Assumption: I guess it is being designed in the way to make Interceptor as much generic as possible but why I can define the Message type in generic here? It seems like converter I defined at SqsConfig being ignored and not used for the interceptors mapping (because it is too much early stage)
Beta Was this translation helpful? Give feedback.
All reactions