Closed tasnimpulikkal closed 2 years ago
In your OnMessage callback, try calling await sl.SendAsync(req);
More information can be found here: https://github.com/Azure/amqpnetlite/blob/master/docs/articles/building_application.md#threading
how to set multiple consumers in amqp 1.0
@tasnimpulikkal What do you mean by multiple consumers
?
after i send multiple messages , how can i receive it in multiple instances of the receiver application? currently it only hits instance1 application evern though i started 4 instances
@tasnimpulikkal 1) Do you want each consumer to receive the same message, or do you want messages distributed among the consumers? 2) What broker are you using?
i want distributed messages among the consumer
Not clear what the question is about. It seems that you started 4 consumer applications and you observed that all messages went to just one application? Is that true regardless how many messages you send? Note that depending on the broker and the message entity type (e.g. queue or topic), messages sent to each consumer may be different.
From the library perspective, you could try to manage the link credits to control how many messages and when they should be transferred to the client (see ReceiverLink.SetCredit
).
Close the issue for now and feel free to open another one for the receiver related questions.
I have 2 projects Project A & project B: the message goes from projectA to projectB. and it handles the messages and upon certain condiotons it sends more messages to say the data is processed to projectA. i am not sure how to set mutiple consumer count from project A like in rabbitmq. and how do we process those messages in the projectB. could you please let me know.
And also i get a timeout exception If I start a consumer client once there are already messages in the queue, it's possible the first receive will timeout (hard-coded at 60 seconds as a constant in AmqpObject). If this happens, the current workaround is to close the session and restart it and receive again, in which case the message will be received and dequeued, if accepted. how do i solve this issue as well??
Publisher project : ProjectA _session = new Session(_connection); SenderLink sl = new SenderLink(_session, "Sender", rcpCall.QueueName);
Sets a receiver for acknowledgement
Receiver project: Project B receiver.Start( 200, async (link, message) => { link.Accept(message); string inputMessage = message.Body.ToString(); await HandleRequest(requestMessage); ----- multiple messages are send to a quue inside here var newsession = setSession(); SenderLink sl = new SenderLink(newsession, "acknowledgement", message.Properties.ReplyTo); Message req = new Message(response); req.Properties = new Properties() { MessageId = "request", ReplyTo = message.Properties.ReplyTo, CorrelationId = message.Properties.CorrelationId }; sl.Send(req);
}); Thanks, Tasnim