Comments (6)
terminate
is not necessarily called on a shutdown: http://elixir-lang.org/docs/v1.1/elixir/GenServer.html#c:terminate/2
What I'm doing is: on init()
link to the connection and the channel. This is not the best solution as it will not allow you to reuse a connection for multiple consumers but at least it's safe to clean up hanging processes. I think this should be fixed upstream (rabbitmq-client)...
from amqp.
@bradleyd You are correct. The channel or connection won't automatically close when a subscriber process dies. Assuming your subscriber is a GenServer, you can use the terminate callback to cleanup and close the channel. Whether you also close the connection or not will depend if you reusing the same connection for other channels (you can open up to 65535 channels in a single TCP connection).
from amqp.
@pma thanks for the response. We are seeing AWS LB close connections after N time of inactivity. The connection is closed unexpectedly--hence creating multiple connections everytime supervisor restarts our consumer.
from amqp.
@edgurgel in our case that would be fine as we only have one consumer
from amqp.
@pma maybe an example in README.md
would be nice?
btw, thanks for all the help and responses
from amqp.
@bradleyd with AWS LB you have to enable heartbeat option to prevent connections dropping:
{:ok, conn} = AMQP.Connection.open([
host: config[:host],
username: config[:username],
password: config[:password],
connection_timeout: 2000,
heartbeat: 30 # <- here it is, in seconds
])
from amqp.
Related Issues (20)
- Application.Connection has a missing case clause on line 113 HOT 1
- where to find documentation HOT 3
- AMQP.Basic.get/3 option no_ack: true not working HOT 2
- Enabling transactional mode for channels? HOT 1
- FunctionClauseError no function clause matching in AMQP.Connection.open/1
- Support amqp_client 3.9.1
- unable to compile: cannot find or invoke local basic_credit_drained/0 inside match HOT 2
- unexpected_delivery_and_no_default_consumer and abandoned consumers HOT 3
- Are streams supported? HOT 3
- Unhandeled Genserver event HOT 1
- Support for streams HOT 1
- How would one approach having tests alongside this library? HOT 2
- There should be some guide on how we could write proper unit tests for this HOT 1
- No feedback when RabbitMQ is unreachable HOT 1
- AMQP issue crashes GenServer irrespective of multiple error handlers. HOT 1
- websocket support HOT 3
- OTP 26 HOT 1
- Issue compiling with Elixir 1.15 (ssl_verify_fun)
- AMQP.Connection doesn't pick the default SSL configuration HOT 1
- Why aren't channels closed when no longer needed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amqp.