By using AWS re:Post, you agree to the Terms of Use
/Reading SQS Message via Listener/

Reading SQS Message via Listener

0

Currently SQS provides way to read messages using listener (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/getting-started.html - Receiving messages asynchronously section). It is only implemented in JAVA. Is there corresponding .net implementation? I mean instead of polling SQS queue, listener should trigger event once message is received in queue.

2 Answers
1

That section corresponds to a JMS interface for SQS that allows existing JMS applications to work with SQS instead of a different JMS compatible product. JMS stands for Java Message Service and as such I do not think there is an implementation in other languages. The implementation of the SQS Java Messaging Library most probably includes a thread that polls the queue and when it receives messages, calls the listener. It can be easy to implement yourself.

Saying that, One way for achieving the asynchronous invocation without writing your own poller would be to use a Lambda function. In that case, the Lambda service does the polling, and it invokes your function when it receives new messages.

EXPERT
answered 2 months ago
0

There are some examples of receiving SQS messages in the SDK developer guide.

If you go to the SQS introduction page and look at the topics, you'll see one for Sending messages and one for Receiving messages. The example for receiving messages uses an async method to wait for and return any messages that are placed into the queue. Perhaps this would be interesting for you to look at.

A fun exercise: If you use the examples cited above to create console apps to both send and receive messages, you can run them both at the same time and send yourself messages. :-)

In addition to the SQS examples cited above, there are also examples in the AWS Docs SDK Examples repo on GitHub. Specifically, in the dotnetv3/SQS folder.

Hope this helps.

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions