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

rejectBasic and qosBasic don't work #16

Closed
bradjorgensen opened this issue Mar 2, 2015 · 2 comments
Closed

rejectBasic and qosBasic don't work #16

bradjorgensen opened this issue Mar 2, 2015 · 2 comments

Comments

@bradjorgensen
Copy link

rejectBasic() doesn't work because it is in the wrong state array in AmqpClient.js. It is in the array for synchronous methods but it is asynchronous so it throws an error.
qosBasic doesn't work because it is not in any of the state arrays in AmqpClient.js.
I am working on a patch to fix these issues.

@brennangaunce
Copy link

qosBasic was verified using a locally build kaazing-amqp-0-9-1-client-javascript with the proposed fix.

For rejectBasic, when requeue is set to false in the rejectBasic Config:

var rejectConfig = {deliveryTag: dt, requeue: false};

The same messages keep getting redelivered to the same client when they shouldn't be.

From Shuaib:
Client technology: JavaScript
Browser with Version: Firefox 35.0.1
Client O/S with Version: OS X 10.10
Gateway with version: 4.0.6.57
Message Broker: Qpid Java Broker 0.28
Can the bug be reproduced in a Kaazing demo out-of-the-box? Yes
Is this a regression from previous released version? Yet to be tested
Gateway config: Right out-of-the-box
Client code to reproduce: Modify setTimeout in handleMessageReceived to call rejectBasic, instead of ackBasic as is done in this snippet:

var handleMessageReceived = function(event) {
    receivedMessageCount.text(++receivedMessageCounter);
    var body = null;

    // Check how the payload was packaged since older browsers like IE7 don't
    // support ArrayBuffer. In those cases, a Kaazing ByteBuffer was used instead.
    if (typeof(ArrayBuffer) === "undefined") {
        body = event.getBodyAsByteBuffer().getString(Charset.UTF8);
    }
    else {
        body = arrayBufferToString(event.getBodyAsArrayBuffer())
    }
    var props = event.properties;
    var exchange = event.args.exchange;
    var routingKey = event.args.routingKey;
    var dt = event.args.deliveryTag;
    var channel = event.target;

    logMessageDiv("MESSAGE CONSUMED: ", "receiveMessage", body, props, exchange, routingKey);

    // Acknowledge the message as we passed in a false for 'noAck' in the
    // AmqpChannel.consumeBasic() call. If the message is not acknowledged,
    // the broker will keep holding the message. And, as more and more
    // messages are held by the broker, it will eventually result in
    // an out of memory error.
    var config = {deliveryTag: dt, multiple: true};

    setTimeout(function() {
        // Acknowledging is a synchronous call with a roundtrip to the server,
        // therefore schedule it independently so as not to block current
        // execution.
        // channel.ackBasic(config);
        var rejectConfig = {deliveryTag: dt, requeue: true};
        channel.rejectBasic(rejectConfig);
    }, 0);
}

If requeue is set to false the message is still redelivered, but should not be.

@sbadugu
Copy link

sbadugu commented May 27, 2015

This issue was moved to kaazing/javascript.client#5

@sbadugu sbadugu closed this as completed May 27, 2015
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

Successfully merging a pull request may close this issue.

3 participants