Giter Club home page Giter Club logo

Comments (9)

ono avatar ono commented on July 16, 2024 1

Added the information to README. Thanks!

from amqp.

pma avatar pma commented on July 16, 2024

@bradleyd Is the client connected directly to the broker? Or through something like haproxy? When using haproxy you can use the heartbeat: n option in AMQP.Connection.open (n seconds must be less than haproxy connection timeout).

from amqp.

bradleyd avatar bradleyd commented on July 16, 2024

It is connected through aws load balancer. Heartbeat is set to 60

from amqp.

bradleyd avatar bradleyd commented on July 16, 2024

Actually that is false. I was thinking of remote connection. This is connection on same host over 127.0.0.1

from amqp.

pma avatar pma commented on July 16, 2024

@bradleyd That excludes the possibility of a load-balancer closing the backend connection...
Looking at the queue status in the RabbitMQ management console, do you see the messages being acked, or are they accumulating in the queue (in either ready or unacked state)?

When looking at the queue detail in the management console, does it still list consumers?

from amqp.

bradleyd avatar bradleyd commented on July 16, 2024

Thanks for trying to help @pma.

The messages are accumulating in ready. The consumer is also listed from console. I sniffed the local consumer port hoping to catch messages, but all I see is what looks like the heartbeat being sent back and forth

from amqp.

trenpixster avatar trenpixster commented on July 16, 2024

@bradleyd I'm also facing the same issue. Did you get any further insight on this?

from amqp.

rafaeljesus avatar rafaeljesus commented on July 16, 2024

I've been through this and realize that I wasn't handling message properly. In the README example that try/rescue may no catch unexpected errors avoiding you to call ack/reject. Consumers needs to send acknowledges (aka.. ack/reject) to the broker so it can send more messages.

No matter what happens handling the message you will ack or reject and the broker will send you more messages:

def handle_info({:basic_deliver, payload, %{delivery_tag: tag, redelivered: redelivered}}, [chan, opts] = state) do
  spawn fn ->
    handler = @opts[:handler]
    with {:ok, data} <- Poison.decode(payload),
         {:ok, _} = handler.handle(data) do
         ack(chan, tag)
    else
       _ -> reject(chan, tag, requeue: not redelivered)
    end
  end
  {:noreply, state}
 end

May it can help someone

from amqp.

ono avatar ono commented on July 16, 2024

Yeah, we had similar issues. If the handler silently fails or is stuck, ack or nack won't be sent. Then once the number gets more than prefetch_count, consumer stops receiving any messages.

@bradleyd @trenpixster can this be a cause of the issue you experienced? Or you are seeing something else?

Since it can be a typical pitfall, I am planning to write something about it in README.

from amqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.