Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make a durable named queue? #107

Open
Icehunter opened this issue Aug 6, 2015 · 0 comments
Open

How to make a durable named queue? #107

Icehunter opened this issue Aug 6, 2015 · 0 comments

Comments

@Icehunter
Copy link

The reason I ask this is because I want to save the messages on a EBS volume so if the container running rabbitmq crashes I can at least connect to the EBS and bring the images back in.

I've used my own library for awhile which handles reconnects and persistence, but I would rather just use yours.

I've tried for the life of me to do something along the lines of direct routing, with routing keys.

Is there an example of working with ack(false/true, [true]) and direct/topic based push/worker?

Something along the lines of:

var context = require('rabbit.js').createContext();
context.on('ready', function () {
    var pub = context.socket('PUB', {
        routing: 'topic'
    });
    pub.connect('events', function () {
        pub.publish('events:create', {
            some: 'value'
        });
        pub.publish('events:try', {
            some: {
                new: 'value'
            }
        });
    });

    var sub = context.socket('SUB', {
        routing: 'topic'
    });
    sub.connect('events', 'events:create', function () {
        sub.on('data', function (item) {
            // item.ack [function]
            // item.message [json]
        });
    });

    var sub2 = context.socket('SUB', {
        routing: 'topic'
    });
    sub2.connect('events', 'events:try', function () {
        sub2.on('data', function (item) {
            // item.ack [function]
            // item.message [json]
        });
    });
});

I know this example won't work like this as you have to stringify the data first, then parse it for some reason. Maybe I'm missing something in the docs however. Any help would be appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant