MassTransit with acknowledgement

2,018 views
Skip to first unread message

Kishore Reddy

unread,
Mar 10, 2017, 10:57:12 AM3/10/17
to masstransit-discuss
Hi All I'm new to MassTransit with RabbitMq 

I created a one sample application to push message and consume message but my problem is those message are automatically deleting with out any acknowledge .


so how to delete the queue message only when the consumer send the acknowledgement .


Thanks
Kishore

Nick Archibald

unread,
Mar 10, 2017, 4:13:53 PM3/10/17
to masstransit-discuss
Not quite sure what you are doing but it sounds like you need to set the 'UseOutbox' setting on your endpoint configuration.

epc.UseOutbox()

Alexey Zimarev

unread,
Mar 11, 2017, 3:16:34 PM3/11/17
to masstransit-discuss
Outbox is not used for that. The message is ACKed only when consumer has finished its work without any errors.

I am not quite sure that the "acknowledge" from the consumer means to be honest.

Nick Archibald

unread,
Mar 13, 2017, 2:00:17 AM3/13/17
to masstransit-discuss
Good point Alexey.

From reading the question again it sounds like the problem that occurs when the queue that you are sending to has not been created yet. RabbitMQ by default does not have a catch all queue so the message are thrown away.  So make sure your Consumer queue is configured and created prior to sending to that queue. If you use the RabbitMQ web management addon you can check to see that the queue you are sending to exists through there.

Kenneth Avner

unread,
Mar 13, 2017, 3:41:10 AM3/13/17
to masstransit-discuss
Or it may be that Kishore does not have the full understanding of how MT use async processing through Tasks.

Kishore, as a message comes in to a consumer for consumption a Task is created. All consuming code runs in the context of this Task. If the Task finishes cleanly, the message is ACKed from the bus. Or if an exception is thrown, error handling commences (retries/moving to error queue). Or if the consuming code dies for other reasons, the message is never ACKed.

You do not explicitly have to deal with ACKing in MT. If you wish to work on that level, you could for instance use the RabbitMQ client directly.

Kishore Reddy

unread,
Mar 13, 2017, 9:19:18 AM3/13/17
to masstransit-discuss
Hi Kenneth,

yes Kenneth what ever you mentioned above is correct  but my requirement is  it would not delete the message from queue until  unless i send an ackn to delete it from queue.

 example : I pushed Hello World  a queue XYZ 
                I consumed from XYZ queue (as of now message is deleting from queue)
          Requirement : it would not delete until unless i send an acknowledgement to delete  like respond

i hope you got my  requirement.


Thanks
Kishore

Alexey Zimarev

unread,
Mar 13, 2017, 9:37:18 AM3/13/17
to masstransit-discuss
Kishore

All messaging frameworks assume that if the message has been successfully consumed, it should be ACKed. There is no explicit "deletion from the queue" operation. Message is being dequeued, consumed and ACKed, then the service bus itself removes it. If consumer fails with an exception, message is retried (this is something MassTransit does for you) if you have retry policy configured, and if all retries fail - it is moved to the _error queue.

So, you have no way to manually ACK the message, it is done only after the consumer has finished its work. MassTransit never ACKs the message before it gets consumed.

Kenneth Avner

unread,
Mar 13, 2017, 2:25:47 PM3/13/17
to masstransit-discuss
Kishore,
Alexey is right. The functionality you are looking for is not typically provided by a messaging framework, nor by MT. Might I suggest you look elsewhere; for instance the RabbitMQ client (https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html) or Windows Message Queue for that matter. Good luck :)

Kishore Reddy

unread,
Mar 20, 2017, 11:33:23 AM3/20/17
to masstrans...@googlegroups.com
Hmm Thanks Kenneth and Alexey. 

On Mon, Mar 13, 2017 at 11:55 PM, Kenneth Avner <ken...@avner.no> wrote:
Kishore,
Alexey is right. The functionality you are looking for is not typically provided by a messaging framework, nor by MT. Might I suggest you look elsewhere; for instance the RabbitMQ client (https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html) or Windows Message Queue for that matter. Good luck :)

--
You received this message because you are subscribed to a topic in the Google Groups "masstransit-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/masstransit-discuss/rgr_3jr7zEY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/e076316b-c7f2-408b-9b5e-27ecbe917f50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
KISHORE REDDY MAMILLA

Yuval Detinis

unread,
Jan 8, 2018, 8:19:48 AM1/8/18
to masstransit-discuss
Dear Kishore Reddy, I am sorry to see that you gave-up so fast... :-)

I've read this thread since I've got to the same case, this is why I tend to agree with you (Kishore Reddy) that the consume stage is not necessarily scoped in the consume async context. And the bus should enable me to resume from a broken consumption process when I haven't completed it (commit on the consume by setting the Ack like it is done in RabbitMQ or in AzureQueue). 

In my case I used a TaskCompletionSource to suspend the end of consume context until my processing is done. Yet, this is an artificial solution that implicitly manage the Ack and is not a clear strait-foreword, instead, the ability to set the Ack explicitly will be the right pattern for such cases.     

  

On Monday, March 20, 2017 at 5:33:23 PM UTC+2, Kishore Reddy wrote:
Hmm Thanks Kenneth and Alexey. 
On Mon, Mar 13, 2017 at 11:55 PM, Kenneth Avner <ken...@avner.no> wrote:
Kishore,
Alexey is right. The functionality you are looking for is not typically provided by a messaging framework, nor by MT. Might I suggest you look elsewhere; for instance the RabbitMQ client (https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html) or Windows Message Queue for that matter. Good luck :)

--
You received this message because you are subscribed to a topic in the Google Groups "masstransit-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/masstransit-discuss/rgr_3jr7zEY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.



--
KISHORE REDDY MAMILLA
Reply all
Reply to author
Forward
0 new messages