Exchange in confirmed mode does not confirm - why? #134

Closed
goloroden opened this Issue Oct 3, 2012 · 29 comments
@goloroden

I'm not sure whether I simply misunderstood confirm mode, or if there is a bug in node-amqp regarding confirm mode ...

Could you be so kind to take a look at http://stackoverflow.com/questions/12662413/rabbitmq-and-node-amqp-exchange-in-confirmed-mode-does-not-confirm-why ?

@barshow

Make sure you're using the correct version. There should in /node_modules/amqp/test/test-publish-confirms-callback.js if you have the correct version of amqp.

@goloroden

Okay, checked it and this file is NOT there.

Although I used the latest version available through npm (which is 0.1.3).
Does that mean that this version is outdated, but a newer one is not yet available?

@barshow

I would pull from github and use master for now, the version isn't bumped yet, and the confirm stuff is new code

@goloroden

Okay ... just one last question: Can you already tell when a new version will be available via npm?

@barshow

I think you can do npm update, but I've never used that.

@goloroden

Okay, problem solved using https://github.com/postwait/node-amqp/tarball/master as version in npm.

However, it would be nice if there was a new npm package with a new version number.

@goloroden goloroden closed this Oct 4, 2012
@kevinohara80

Is this still not in the latest published version? Confirm is not working for me. The callback never fires.

I'm on 0.1.7

@kevinohara80

I tried adding listeners to the publish object vs the callback. No dice.

@shernshiou

I met the same problem as @kevinohara80. (Both listener or callback)
I'm on 0.1.7

@krootee

Same issue here - callback is not called.
v 0.1.7

@shernshiou

Get the latest from master instead from release.

@krootee

Thanks - version from master is working correctly in this case.

@kevinohara80

Will this ever get released?

@postwait
Owner

I'm on vacaction, so it will be a few weeks...

unless someone wants to verify the test suite all passes (and if it doesn't fix the issues).

@kevinohara80

In looking at the test suite, it looks like it will pass no matter what happens. I can try to put together a PR today or tomorrow to update and verify the tests.

I'll attach the PR to the issue I opened the other day that's still open.

#225

@vvilhonen

Tried with the master with no luck..

@ssafejava

Fixed this in STRML/node-amqp@8d3d579,

A lot of tests are not passing in the official release and in the official HEAD. It's looking like interest in support the project has waned. Even the Travis CI config is not working, so a lot of recent PRs broke functionality without notice.

If you want a stable version of node-amqp try the fork linked above.

@vvilhonen

@ssafejava Great work, thank you!

@yahuarkuntur

any updates on this? I still can't get it to work, not even with ssafejava's fork...

Thanks in advance!

@ssafejava

@yahuarkuntur This is working in the test cases, take a look at the commit above. Maybe you're missing a configuration option?

@yahuarkuntur

OK, I got it to work as shown above, but I can't use the default exchange for the same purpose...

connection.on('ready', function () { 
    console.log('connection ready');
    connection.exchange('node-exchange', {autoDelete: false, confirm: true, durable: true, type: 'direct'}, function(exchange) {
        console.log('exchange ready ' + exchange.name );
        connection.queue('node-queue', {autoDelete: false, durable: true}, function(queue){
            console.log('queue ready '  + queue.name);
            queue.bind(exchange, 'node-direct-key');
            exchange.publish('node-direct-key', message, {deliveryMode: 2}, function() {
                console.log('message published');
            });
        });
    });
}); 

Thank you!

@ssafejava
@yahuarkuntur

@ssafejava thanks for clearing me that out 😄

Cheers!

@athlan

I confirm, works for me when i used https://github.com/postwait/node-amqp/tarball/master (master, not release)in packages.json instead of last version from npm.

Example codes:

worker/listener:

var amqp = require('amqp');
var connection = amqp.createConnection();

    connection.on('ready', function() {

    connection.exchange("sub16", {
    autoDelete: false,
    confirm: true,
    durable: true,
    type: 'direct'
  }, function(exchange) {

    connection.queue('sub1234', {
    }, function(q) {
      q.bind(exchange, 'r1');

      q.subscribe({
                ack: true
            }, function(json, headers, deliveryInfo, m) {
        console.log("msg: " + JSON.stringify(json));

        setTimeout(function() {
                q.shift();
        }, 500);
      });
    });
    });
});

message dispatcher/publisher:


var amqp = require('amqp');
var connection = amqp.createConnection();

connection.on('ready', function() {
    console.log('one');

  connection.exchange('sub16', {
    autoDelete: false,
    confirm: true,
    durable: true,
    type: 'direct'
    }, function(exchange) {
    console.log('exchange ready ' + exchange.name );

    var publish = exchange.publish('r1', { a: 'b' }, {deliveryMode: 2, immediate: true }, function() {
      console.log('message published');
    });

      publish.addListener('ack', function() {
      console.log('ack received');
      });
      console.log('message sent');
  });
});
@mratzloff

Can we get an updated npm release? This certainly warrants it. Thanks!

@kevinohara80
@ssafejava
@jbyrneie

All the above comments/code are creating the Exchange. I am using "amqp 0.2.4". My Exchange already exists. I do not get a callback when I publish a message to the Exchange. How can I determine that the message has been successful or failed when published

@jacksonhull

if you are struggling with this, try adding
persistent: false
to your publish command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment