-
-
Notifications
You must be signed in to change notification settings - Fork 337
Open
Labels
component: snsSNS integration related issueSNS integration related issuecomponent: sqsSQS integration related issueSQS integration related issuetype: bugSomething isn't workingSomething isn't working
Description
Type: Bug
Component: SNS, SQS
Description
Reference documentation mentions that when we receive SNS messages through the @SqsListener
, the message includes all attributes of the SnsNotification
. However, the attributes are not passed to message headers.
Sample
Having an SQS queue that is subscribed to SNS topic (raw message delivery is disabled), when sending to SNS via snsTemplate
as following
snsTemplate.convertAndSend(topicName, pojo, Map.of("my-attribute", "attribute-value"));
and receiving the message via @SqsListener
as following
@SqsListener("${queueName}")
public void processGreetingsEvent(Message<?> message){
System.out.println(message.getHeaders().get("my-attribute"))
}
then null is printed instead of "attribute-value".
The same effect is seen when receiving as following
@SqsListener("${queue.name}")
public void processGreetingsEvent(@SnsNotificationMessage Pojo pojo, @Headers Map<String, Object> headers) {
headers.get("my-attribute"))
}
Am I missing something? Is there a way I can access the attributes (I did not find direct information in the documentation).
Metadata
Metadata
Assignees
Labels
component: snsSNS integration related issueSNS integration related issuecomponent: sqsSQS integration related issueSQS integration related issuetype: bugSomething isn't workingSomething isn't working