Skip to content

Amazon ActiveMQ drops connection for long running listeners #163

@austinbittinger-inmar

Description

@austinbittinger-inmar

Hi there! My team currently uses ActiveMQ as a centralized queue between all of our microservices, and we've adopted this gem to interact with ActiveMQ. I've been scratching my head for a little while, as it seems like the connection inevitably drops after 20 minutes. Here's a simplified version of what we're using:

client = Stomp::Client.new(
  hosts: [
    login: ENV['STOMP_USERNAME'],
    passcode: ENV['STOMP_PASSCODE'],
    host: ENV['STOMP_HOST'],
    port: ENV['STOMP_PORT'],
    ssl: true
  ],
  connect_headers: {
    'client-id' => 'my-service',
    'accept-version' => '1.2',
    'host' => 'localhost'
  }
)

client.subscribe('queue/1', id: SecureRandom.uuid, ack: 'client') do |msg|
  Handler1.perform_async(msg)
  client.acknowledge(msg)
end

client.subscribe('queue/2', id: SecureRandom.uuid, ack: 'client') do |msg|
  Handler2.perform_async(msg)
  client.acknowledge(msg)
end

client.join

Running this locally, the client will trigger on_miscerr and reconnect after about 10 minutes, but against Amazon MQ, the connection will drop but the client does not attempt a reconnect.

With a custom logger logging every transaction here, the client receives an on_receive event, and then drops the connection. Do you have any suggestions for how I could go about debugging this issue? I've tried just about every parameter on the client, and logged everything I can. If it helps, this client is running within a Kubernetes pod, pointing at a VPC only configuration of Amazon ActiveMQ.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Await User ReplyWaiting For a reply from the user.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions