[erlang-questions] RabbitMQ message consumption

Sölvi Páll Ásgeirsson solvip@REDACTED
Fri May 12 14:42:59 CEST 2017

I think you want to use RabbitMQ's message acknowledgement.

The general idea is that you:
- Consume a message
- Process it
- Acknowledge to RabbitMQ that you've processed it, which causes it to be
deleted from the queue.

You can read more at https://www.rabbitmq.com/confirms.html

If you're using the Erlang RabbitMQ client, you can do something like this
when subscribing:

  #'basic.consume_ok'{} = amqp_channel:subscribe(Channel,
#'basic.consume'{queue = Queue, no_ack = false}, self()),

Then, when you've handled your message, you call:

    amqp_channel:cast(Channel, #'basic.ack'{delivery_tag = Tag}).

Hope this helps


On Fri, May 12, 2017 at 11:55 AM, Kareem Hepburn <kareemgan@REDACTED>

> Is it possible with RabbitMQ to consume a message without it being deleted
> and be deleted manually?
> Because let's say I consumed a message and started to process it and half
> way through processing it the application fails. I want to be able to
> re-process that message again. Is it possible to not delete the message and
> delete it manually after my process has successfully completed?
> To avoid duplication, I plan to use a secondary database, either Redis or
> Memcache to store the ID of the message to ensure that it's not being
> processed by more than one application.
> Thanks!
> --
> [image: kareemgan] <http://kareemgan.com>
> Kareem Gan / Software Engineer
> kareemgan@REDACTED
> [image: Skype] <https://github.com/magicalbanana> [image: Facebook]
> <http://facebook.com/dopankey> [image: Twitter] <http://@kareemgan> [image:
> Google Plus] <https://plus.google.com/108299918329354290658> [image:
> Linkedin] <https://linkedin.com/in/kareemgan> [image: Skype]
> <http://kareemgan>
> This e-mail message may contain confidential or legally privileged
> information and is intended only for the use of the intended recipient(s).
> Any unauthorized disclosure, dissemination, distribution, copying or the
> taking of any action in reliance on the information herein is prohibited.
> E-mails are not secure and cannot be guaranteed to be error free as they
> can be intercepted, amended, or contain viruses. Anyone who communicates
> with us by e-mail is deemed to have accepted these risks. Company Name is
> not responsible for errors or omissions in this message and denies any
> responsibility for any damage arising from the use of e-mail. Any opinion
> and other statement contained in this message and any attachment are solely
> those of the author and do not necessarily represent those of the company.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170512/cbe0fc6a/attachment.htm>

More information about the erlang-questions mailing list