Manually receive messages to consumer #3218
Replies: 5 comments 1 reply
-
MassTransit doesn't support pull, only push. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. We're falling back to using |
Beta Was this translation helpful? Give feedback.
-
I had the same issue with integrating Keda and MassTransit. What I ended up doing was setting Also, I had to make sure that only one type of consumer is running cause when the Observer calls PostConsume the other running consumer is now short-circuited (will be placed in deadletter). |
Beta Was this translation helpful? Give feedback.
-
I've been in the same boat, dealing with issues around waiting for all messages to be processed before returning the complete response from all queues. |
Beta Was this translation helpful? Give feedback.
-
This has come up for me as well. I need to put items in the queue at a regular interval, but if for some reason items are still stuck in the queue, I would skip until the next interval. This is mainly because of a flaky third party API. If it can't keep up we need to slow down. Without a means of checking the queue this is kind of difficult. I'm using SQL transport. I have some ideas for work arounds. My application is a monolith so it isn't too difficult to determine if the app is currently consuming. If I were to break this into microservices it would be more difficult though. |
Beta Was this translation helpful? Give feedback.
-
We're running a setup with Service Bus and MassTransit where containers are initialized by KEDA.
KEDA monitors a "job" queue, and each time a message arrives on that queue, it will start a new pod/container to handle this job.
One container should only handle one message.
Therefore, we want to be able to configure MassTransit so that the consumer is not receiving multiple messages from the queue.
Right now we have tried creating the bus, and then connecting the receive endpoint manually with
PrefetchCount = 1
andConcurrentMessageLimit = 1
. The moment theHostReceiveEndpointHandle
isReady
, we stop the handle withStopAsync()
.However, this is flawed, and we don't get any messages on it.
So my question is:
How can we manually choose when to get a message from the queue? You can do it in the Azure portal by clicking the "Receive" button on the queue. It will only receive one message and then delete it from the queue. Can we somehow have the same behavior in MassTransit in a stable way?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions