Comments (5)
That's a good suggestion. Would you mind to provide a patch for that, or do you prefer me to do that?
from stompest.
Right now I'm just working on a side project in my spare time that happens to use STOMP and tracking issues I run into along the way.
If I get into the project seriously with more time to play with I'll write the stuff in myself. But in the meantime if you feel like implementing it go ahead.
from stompest.
I just meditated over this issue, and these questions came up:
- What do you mean by a "working"
host
header? For ActiveMQ, you don't need that header at all to get a connection to "work", and for Apollo it should be a virtual (that is, logical) host rather that a physical address, so I right now don't see the rationale of putting a physical address in that header. The broker will know its physical address anyway. I'd rather expect a virtual host to remain the same upon failover to another broker instance. - What if you used another transport? Say, a non-IP transport. What would you fill in for the
host
then?
To me it looks like one shouldn't intermingle the physical transport and the logical STOMP session, and the code seems to confirm that, because it is not so easy to implement the desired behavior for both clients (sync and async) without mixing transport and STOMP session concerns (breaking SRP) and writing redundant code in both clients (breaking DRY).
@dantman: What's your opinion on this?
from stompest.
Apollo's default (and/or example) configs setup a virtual host named (localhost
, 207.0.0.1
, etc...). When configured like that Apollo will generally reject requests with an empty host
header if you use STOMP 1.1+. By working I'm talking about what you need to do to get something that's non-empty. Because host
doesn't carry over anywhere from config leaving you stuck in an awkward flow where you have to explicitly carry some extra custom config into other parts of your code just to set the host
header.
virtual hosts in STOMP are basically carried over from HTTP. They work the same way. Filing the host
header with whatever address or hostname you used to connect with is the expected behaviour. The purpose is basically so that if you point the dns for foo.tld
and bar.tld
to the same address the host
header will respectively contain foo.tld
and bar.tld
and the server will be able to differentiate between the two. It's practically never an explicit name. There is nothing really strange about two different servers even for fallover getting different hosts. Virtual host configuring is unique to each server. Using the same virtual host name on each server is not a requirement for connecting them to the same messaging group.
The STOMP spec is actually quite clear on this behaviour "It is recommended clients set this to the host name that the socket was established against, or to any name of their choosing." which would basically in our case would translate to defaulting to the hostname of the connected server but providing a config that lets you set a fixed host for all connections.
On a non-IP transport. IF you were directly connecting through it you'd probably leave that blank. host
is inherently an IP transport oriented header. You don't have the same kind of limitations you do in IP with say a unix socket. In that case if there were any header at all it should be explicitly set. (Although for that circumstance we should still add some extra config to allow that to be specified in config instead of forcing it to be passed to connect).
from stompest.
In the Apollo integration tests, I set the host
header to the logical host name mybroker
, on RabbitMQ, it is /
. Both aren't really socket addresses.
But I think you're right: In their connect()
methods, sync
and async
client should store the "name" of the host they connected against on the wire level and substitute a missing host
argument (None
). But the transport level should decide what that "name" is. It is very important to keep both clients transport agnostic.
In the async
client, we should set the host
attribute on the StompProtocol
instance and let the Stomp.connect()
method substitute the host
header here. The definition of frame
has to move further down; there is no reason for it to be so far up anyway.
The StompFrameTransport
of the sync
client already has this host
attribute, so the substitution in Stomp.connect()
can take place in exactly the same way.
from stompest.
Related Issues (20)
- ipv6 support HOT 1
- stompest consumer is slow for activemq HOT 4
- How to config exclusive=true ? HOT 4
- Messages not recieving after queue is idle for some time HOT 1
- failover option 'startupMaxReconnectAttempts' default value should be -1
- Support for asyncio HOT 2
- Asynch examples on ActiveMQ - Artemis HOT 1
- support SSL client auth in stompest.async HOT 5
- Exception <class 'select.error'>: (4, 'Interrupted system call') after upgrading stompest HOT 4
- stompest.async will be unusable on python 3.7+ HOT 10
- receiveFrame does not accept a timeout parameter HOT 3
- Thread-unsafe issue if we set ack=True in SubscriptionListener HOT 3
- How to dynamically increase the number of consumers HOT 1
- Invalid SUBSCRIBE format HOT 2
- StompFrame and StompHeartBeat __str__ method returns bytes in Python 3
- failover doesn't seem to be working HOT 1
- how to get JMSXDeliveryCount in the stomp frame HOT 1
- When use version=1.2, the consumer stop to connect on topic
- collections.MutableMapping is not available in Python 3.10 HOT 7
- STOMP over websocket
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 stompest.