Giter Site home page Giter Site logo

New version about rabbit.js HOT 11 CLOSED

andresberrios avatar andresberrios commented on August 27, 2024
New version

from rabbit.js.

Comments (11)

squaremo avatar squaremo commented on August 27, 2024

I've seen some interesting and very useful changes in the master branch and I'm wondering when
they will be released, are you close to a new release?
Or otherwise, would you say it's safe to point npm to the master branch directly in the meantime?

I don't think it's safe to point npm at a git repo in general. Lately I've changed my mind back and forth in the master branch, which I ought to have done in a feature branch, so there's an illustration of why not!

I'm not sure about the "resume" stuff yet, so I'll probably not release that for the time being. I may make a release without it, though.

from rabbit.js.

andresberrios avatar andresberrios commented on August 27, 2024

Great, thanks!

from rabbit.js.

squaremo avatar squaremo commented on August 27, 2024

I should say that while I don't recommend using git master in your production system, I would be grateful for any reports of using the new features in development

from rabbit.js.

andresberrios avatar andresberrios commented on August 27, 2024

Well, for example, we wanted to use one PUB socket to publish messages to different topics according to the current action our application is performing. We were reading the readme in the repo and tried it but later realised that in 0.4.0 it wasn't possible to use them this way. So now we are switching into creating different sockets for the different topics, and closing them after we don't need them anymore. I'm not sure but I think it shouldn't be that bad, since the real connection to the server is actually established when creating the context, right?
Any advice on this?

from rabbit.js.

andresberrios avatar andresberrios commented on August 27, 2024

Another thing is that we need our published messages to be stored in a queue so that they are not lost if the SUB socket hasn't connected yet before the PUB socket starts publishing. For now, we are using the HTTP API of RabbitMQ to create the queue (or make sure it's there) when the application starts. Is there a way we can manage queues and/or bindings from rabbit.js? It's not critical, just want to know haha
Thanks!

from rabbit.js.

squaremo avatar squaremo commented on August 27, 2024

So now we are switching into creating different sockets for the different topics, and closing them after we don't need them anymore.

Right, yes that is just the thing #publish and the 'topic' option are designed for.

var pub = ctx.socket('PUBLISH', { routing: topic });
pub.connect('events');
// ...
pub.publish('component.warning', JSON.stringify({foo: "bar"}), 'utf8');

Another thing is that we need our published messages to be stored in a queue so that they are not lost if the SUB socket hasn't connected yet

You would have to create a queue per subscriber, before starting any publishers, which is effectively the same as opening the sub sockets before you start any publishers. There's synchronisation required whatever you do.

RabbitMQ and AMQP won't help you with this, or not much. There's no provision for consumers catching up with old messages. If you cannot miss messages, better to stick them in a database and replay them for new subscribers, although you still have a kind of synchronisation problem (that is, figuring out when to switch from the replayed messages to the freshly-published messages).

from rabbit.js.

andresberrios avatar andresberrios commented on August 27, 2024

I see. For now we switched to creating and closing sockets for different topics until there's a new release. Do you think this is going to be a problem in terms of performance or anything like that?
Thanks a lot for the help.

from rabbit.js.

squaremo avatar squaremo commented on August 27, 2024

For now we switched to creating and closing sockets for different topics until there's a new release. Do you think this is going to be a problem in terms of performance or anything like that?

You are right that the connection is created just once; but, each socket still uses its own channel and may require some round-trips to declare various queues and what-have-you, so creating sockets is a little expensive too.

Perhaps I should roll a release with the topic stuff, and put the resume stuff on a branch for later.

from rabbit.js.

andresberrios avatar andresberrios commented on August 27, 2024

I see. Well that would be really awesome :D let me know if you do it, since we would change our code accordingly as soon as possible.

from rabbit.js.

squaremo avatar squaremo commented on August 27, 2024

v0.4.1 is published to npm. It has the topic stuff and the persistent option, but not the subscription resume stuff.

from rabbit.js.

andresberrios avatar andresberrios commented on August 27, 2024

Amazing! Thanks a lot!

from rabbit.js.

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.