-
For example if I have 2 SQS queue's https://sqs.us-east-1.amazonaws.com/012345678910/MyQueue1, https://sqs.us-east-1.amazonaws.com/012345678910/MyQueue2, it is possible to subscribe & process messages from MyQueue1 & MyQueue2 with in the same application ? By looking at the library , it looks like it is possible by adding AddSQSPoller with different queue names. My understanding is that if a message is registered with handler , irrespective from which queue message is received, if handler is found for a message it will be invoked. In other wards handlers are not tied to the queue . Is this correct ? builder.Services.AddAWSMessageBus(builder =>
{
builder.AddSQSPoller("https://sqs.us-east-1.amazonaws.com/012345678910/MyQueue1");
builder.AddMessageHandler<ChatMessageHandler, ChatMessage>("chatMessage");
builder.AddSQSPoller("https://sqs.us-east-1.amazonaws.com/012345678910/SomeOtherQueue");
builder.AddMessageHandler<ChatMessageHandler, ChatMessage>("chatMessage");
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, you can subscribe to multiple queues from a polling application. A single You only need to register the message handler one time, they are not tied to a specific queue. Note that they are registered and retrieved as scoped services, so the handler will be created once per each message that is received.
|
Beta Was this translation helpful? Give feedback.
Yes, you can subscribe to multiple queues from a polling application. A single
BackgroundService
will poll both queues, with a long-running task for each queue.You only need to register the message handler one time, they are not tied to a specific queue. Note that they are registered and retrieved as scoped services, so the handler will be created once per each message that is received.
aws-dotnet-messaging/src/AWS.Messaging/Services/HandlerInvoker.cs
Lines 57 to 59 in db7703f