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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ