In an out-of-the-box configuration of the Spring Integration AWS SnsMessageHandler
outgoing channel adapter, a Spring Message
header named nativeHeaders
of type LinkedMultiValueMap
is populated somewhere along the chain. During the conversion process to an SNS message, the handler delegates to the SqsHeaderMapper
, which issues a log at WARN
level for every message that the automatically-populated nativeHeaders
can't be converted to an AWS-compatible format.
I don't want to suppress logs from the SqsHeaderMapper
in case there's a real bug (like I forget to stringify some POJO header value), but I don't see either a flag to prevent creation of the nativeHeaders
header or a way to configure the SqsHeaderMapper
instance that's privately owned by the SnsMessageHandler
. Is there a clean way to remove this warning?
The
nativeHeaders
is populated by theNativeMessageHeaderAccessor
. I believe this is the part of SNS consumer and its handler. Or SQS. Then it looks like you propagate the message downstream to SNS. And you probably you really mean aSnsHeaderMapper
in theSnsMessageHandler
.I don't think it is really a header mapper responsibility to prevent such a warn for specific headers. It cannot know what is intentional and what is not. Likely now you have a warn, so you are good to use a
HeaderFilter
beforeSnsMessageHandler
to remove those headers which cannot be mapped to SNS attributes.And sure! You can inject a custom
SnsHeaderMapper
with any desired logic overridden.