Comments (3)
I believe the behavior is expected.
You have issued connect, and subscribe, but the broker has not had time (yet) to get data on the wire and have it physically available to the client. Specifically the socket is returning false to 'socket.ready?'. It means there is nothing (yet) to be received, i.e nothing in the socket's input buffers.
I understand that the 'queue already has messages on it'. But in your example, the first one is still in flight from the server to the client.
Note that this can even occur when the client and broker are resident on the same system.
I would normally use poll something like this:
while true
message = conn.poll
if message
# process message
else
sleep x
end
end
The point of poll is that it is asynchronous (non-blocking). If there is nothing to receive, you can go and attend to other required tasks, or sleep to wait for a message to arrive.
If you want a synchronous (blocking) receive, then ask for one:
message = conn.receive
from stomp.
For completeness, I am going to document that 'poll' is indeed broken using JRuby. And it will remain broken until the JRuby team addresses this:
http://jira.codehaus.org/browse/JRUBY-5617
from stomp.
Yeah I too prefer receive, but had to play with poll and noticed the odd behavior.
Thanks for the great description of whats going on though, much appreciated. I was going to file some jruby issues but I guess there's little point :)
You can close this, thanks!
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.