Publish to SNS

 

The Publish action sends a message to all of a topic’s subscribed endpoints. A returned messageId indicates that the message was saved and Amazon SNS will attempt to deliver it to the topic’s subscribers shortly. The format of the outgoing message to each subscribed endpoint depends on the notification protocol selected. Lets see how we can publish to SNS

Create project in Anypoint studio and configure the listener to trigger the flow

Drag and drop publish operation and provide the connector configuration

Publish to SNS

 

Topic ARN: The topic you want to publish to.

To get the topic arn you can get the arn value from Amazon SNS Service as shown below

Publish to SNS

 

Message:The message you want to send to the topic.

Subject:Optional parameter to use as the “Subject” line when the message is delivered to email endpoints

Publish to SNS

 

Create the transform message to send the message to subscribed endpoint as a string value

%dw 2.0
output application/json
---
'{
    "EmployeeId":1234,
    "EmployeeName":"John",
    "EmployeeEmail":"Dey"
}'

Publish to SNS

 

See below url to check when we need to send the string message and when as a json object

https://docs.aws.amazon.com/sns/latest/api/API_Publish.html

Create the transform message to send messageid

%dw 2.0
output application/json
---
payload

Deploy the project and trigger to test from soapui

 

You can see the message received on endpoint as shown below

Sample application : publishmessagetosnstopic sample

Soap ui sample project: PublishtoSnsTopic-soapui-project

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Nehal Jain
Nehal Jain
1 year ago

How do we achieve fail over for SNS publish? For e.g. while publishing to any queue in JMS, if it fails for some reason, it creates DLQ and message is persisted in DLQ, thus we don’t loose the message. Is there any such mechanism present for SNS?