GithubHelp home page GithubHelp logo

Comments (3)

nikipore avatar nikipore commented on September 15, 2024

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.

arjunv avatar arjunv commented on September 15, 2024

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.

nikipore avatar nikipore commented on September 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.