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 回答
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.

profile pictureAWS
专家
Uri
已回答 2 年前
profile picture
专家
已审核 1 个月前
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.

AWS
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则