Comments (11)
Periodically publishing to a hearbeat topic seems to trigger the reconnect logic. Tested with RabbitMQ 2.8.6.1
require 'bundler/setup'
require 'stomp'
require 'json'
require 'pp'
hash = { :hosts =>
[
{ :login => "guest",
:passcode => "guest",
:host => 'localhost',
:port => 61613,
}
]
}
client = Stomp::Client.new(hash)
client.subscribe("/queue/foo") do |message|
if message.headers["content-type"] =~ /json/
pp JSON.parse(message.body)
else
pp message.body
end
end
Kernel.trap(:INT) {
client.close
puts "Recieved term, stopping..."
exit 0
}
loop do
sleep 1
begin
client.publish("/topic/heartbeat","beat")
rescue Stomp::Error::NoCurrentConnection => e
puts "Retry in 1s"
sleep 1
retry
end
end
from stomp.
Hi - I could not recreate this here with a quickly setup test (using AMQ) on Ubuntu, however will continue to experiment a bit.
What gem version are you running?
Why does your example require 'bundler/setup? It seems unused.
What Ruby version? (Should not matter, but ....).
With AMQ are you using 'stomp://' or 'stomp+nio://'? AMQ 5.7.0 has some ragged edges when using nio.
Are your brokers on the same machine as the client?
If you could enable a call back logger (see the examples) for one of these tests, and pastebin the output that might be helpful.
Thanks, Guy
from stomp.
FYI - I have not been able to recreate this in a variety of tests and environments.
Servers used: AMQ 5.7.0 and RabbitMQ 2.8.4. Both servers on Linux (Ubuntu). I did not test against Apollo, but am confident the results would be the same.
Client environments used: Ubuntu 11.10, Win 7, OSX 10.8.0.
In all these tests reconnecting at least 3 times succeeds.
One point to note: give the 'subscribe' parameters you use above, even if you do reconnect, it is likely that there will be nothing to receive from /queue/foo. You need something other than :ack => "auto" to prevent that.
from stomp.
Thank you very much, Guy. I've been a tied up since the past few days. I'll be sure to follow up with more comprehensive test results and data ASAP.
from stomp.
Any updates on this? Just curious ......
Thanks, Guy
from stomp.
This issue report is ancient. I am going to close this, with no resolution.
Please re-open this issue including code that can reproduce the problem when you have developed that code.
from stomp.
I'm experiencing the same with AMQ 5.5.1 . Gem version is 1.2.8
I can constantly reproduce the problem with these steps:
- start AMQ
- start my consumer, it connects immetiately, all fine
- stop AMQ, consumer starts to try to reconnects
- start AMQ again, consumer reconnect, all fine
- stop AMQ, consumer dies, exception is in lib/client/utils.rb , line 100, message is nil
I can provide more info, I can test with AMQ 5.7.0 too, please let me know
from stomp.
same behaviour with AMQ 5.7.0
from stomp.
Thanks. With your description, this can actually be recreated. Reopened.
from stomp.
thanks to you, tell me if you need more info
from stomp.
Thanks for the hint about utils.rb, line 100. That was being masked in previous attempts to recreate this.
Closed: 3198504
from stomp.
Related Issues (20)
- Unexpected ACK received for message-id HOT 7
- multihost failover not really working HOT 1
- netio.rb:47:in `block (2 levels) in _receive': Connected, header read is nil, is this really a Stomp Server? (Stomp::Error::StompServerError) HOT 4
- Nasty-looking exception under jRuby HOT 3
- 1.4.5 gives me a ServerFrameNameError HOT 6
- OpenSSL Deprecations HOT 2
- New Release request HOT 3
- Code for ENV keys not in release HOT 3
- Support Stomp+SSL Url Strings in non-failover case. HOT 4
- Header decode shortcoming HOT 1
- stdout polluted with stack trace HOT 1
- Amazon ActiveMQ drops connection for long running listeners HOT 3
- rspec3 - doubles or partial doubles from rspec-mocks outside .... HOT 6
- Warning: constant ::Fixnum is deprecated HOT 1
- Provide tagged 1.4.9 release HOT 1
- Is there any method to check if subscription is present? HOT 1
- Subscribers are not receiving all messages that we are publishing HOT 9
- Man pages Debian.
- URL options not supported when passing URL to client
- What range of ruby versions are supported?
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 stomp.