Comments (3)
Well, you shouldn't let concurrent consumers access the same socket in an uncontrolled fashion to begin with.
And no, exactly the two methods connect()
and canRead()
do the heavy lifting (i.e. socket communication) on the transport level. If you look under the hood, canRead()
harvests what is on the socket, while receiveFrame()
acts on the protocol level.
from stompest.
I understand what you mean. But the fact that ActiveMQ supports multiple concurrent consumers is being used by me to run multiple instances of a script to distribute an action based on the data from the queue. The uncontrollable fashion is sadly something cannot be dealt with (its real time data that can come in waves of thousands and then die for long periods).
Adding some sort of timeout, so that the instances does not keep listening on such a rare case (queue popped by another consumer in between canRead
and receiveFrame
, which happened multiple times in my case), would have been really awesome.
Anyways thanks for this awesome project :)
from stompest.
The support of multiple subscriptions is a property of the STOMP protocol, not just ActiveMQ. We're on the session level here (hierarchy: transport < protocol < session < client-specific concurrency scheme). You should use some concurrency primitive, say a threading.Lock()
or threading.RLock()
to govern access to the session.
Single-threaded event-driven concurrency models (Twisted, asyncio
, Greenlets, ...) as opposed to parallel models (multiprocessing
, threading
) are the concurrency model of choice for your use case: many concurrent users of a single I/O resource. So, you'll be best off using the Twisted client stompest.async
. Feel free to port it to the new name stompest.twisted
(which should be pretty straightforward), or to asyncio
(less straightforward).
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
- 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.