On 26/08/16 18:50, Matt Broadstone wrote:
Hi all,

It was my understanding that if you replied to a received message with a
`released` outcome, that the broker would attempt re-delivery to either the
link that received it or some other attached link. Is that correct?

That is correct.

 I'm
not seeing this behavior with this simplified use case (using node-amqp10):
>
const amqp = require('amqp10');
let client = new amqp.Client();
client.connect('amqp://<some qpidd ip>')
  .then(() => Promise.all([
    client.createSender('test.queue'), client.createReceiver('test.queue')
]))
  .spread((sender, receiver) => {
    let receiveCount = 0;
    receiver.on('message', msg => {
      receiveCount++;
      if (receiveCount === 10) process.exit(0);
      console.log('received[', receiveCount, '], releasing');
      receiver.release(msg);
    });

    return sender.send({ test: 'message' });
  });

I think you may be accepting before you release? What qpidd sees is:

2016-08-26 20:02:36 [Protocol] trace [qpid.127.0.0.1:5672-127.0.0.1:46958]: 1 
<- @disposition(21) [role=true, first=0, last=0, settled=true, 
state=@accepted(36) [], batchable=false]
2016-08-26 20:02:36 [Protocol] trace [qpid.127.0.0.1:5672-127.0.0.1:46958]: 1 
<- @disposition(21) [role=true, first=0, last=0, settled=true, 
state=@released(38) [], batchable=false]

The second disposition is ignored.

Running the attached release example against qpidd, I see the behaviour I would expect:

$ PN_TRACE_FRM=1 ./release.py
[0x55ee3ab25570]:  -> SASL
[0x55ee3ab25570]:  <- SASL
[0x55ee3ab25570]:0 <- @sasl-mechanisms(64) 
[sasl-server-mechanisms=@PN_SYMBOL[:ANONYMOUS, :PLAIN]]
[0x55ee3ab25570]:0 -> @sasl-init(65) [mechanism=:ANONYMOUS, 
initial-response=b"[email protected]"]
[0x55ee3ab25570]:0 <- @sasl-outcome(68) [code=0]
[0x55ee3ab25570]:  -> AMQP
[0x55ee3ab25570]:0 -> @open(16) [container-id="f8de2985-4cd1-4262-8811-22e44e50a5fc", 
hostname="localhost", channel-max=32767]
[0x55ee3ab25570]:0 -> @begin(17) [next-outgoing-id=0, 
incoming-window=2147483647, outgoing-window=2147483647]
[0x55ee3ab25570]:0 -> @attach(18) [name="f8de2985-4cd1-4262-8811-22e44e50a5fc-examples", 
handle=0, role=true, snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) 
[address="examples", durable=0, timeout=0, dynamic=false], target=@target(41) [durable=0, 
timeout=0, dynamic=false], initial-delivery-count=0]
[0x55ee3ab25570]:0 -> @attach(18) [name="f8de2985-4cd1-4262-8811-22e44e50a5fc-examples", 
handle=1, role=false, snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) [durable=0, timeout=0, 
dynamic=false], target=@target(41) [address="examples", durable=0, timeout=0, 
dynamic=false], initial-delivery-count=0]
[0x55ee3ab25570]:0 -> @flow(19) [incoming-window=2147483647, 
next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=0, 
link-credit=10, drain=false]
[0x55ee3ab25570]:  <- AMQP
[0x55ee3ab25570]:0 <- @open(16) [container-id="a6022696-2483-49f5-8ea6-a6f50db0e7ae", channel-max=32767, 
offered-capabilities=@PN_SYMBOL[:"ANONYMOUS-RELAY"], properties={:product="qpid-cpp", :version="0.35", 
:platform="Linux", :host="localhost.localdomain"}]
[0x55ee3ab25570]:0 <- @begin(17) [remote-channel=0, next-outgoing-id=0, 
incoming-window=2147483647, outgoing-window=2147483647]
[0x55ee3ab25570]:0 <- @attach(18) [name="f8de2985-4cd1-4262-8811-22e44e50a5fc-examples", 
handle=0, role=false, snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) 
[address="examples", durable=0, timeout=0, dynamic=false, distribution-mode=:move], 
target=@target(41) [durable=0, timeout=0, dynamic=false], initial-delivery-count=0]
[0x55ee3ab25570]:0 <- @attach(18) [name="f8de2985-4cd1-4262-8811-22e44e50a5fc-examples", 
handle=1, role=true, snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) [durable=0, timeout=0, 
dynamic=false], target=@target(41) [address="examples", durable=0, timeout=0, 
dynamic=false], initial-delivery-count=0]
[0x55ee3ab25570]:0 <- @flow(19) [next-incoming-id=0, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=1, delivery-count=0, link-credit=500, drain=false]
[0x55ee3ab25570]:0 -> @transfer(20) [handle=1, delivery-id=0, delivery-tag=b"1", 
message-format=0, settled=false, more=false] (78) 
"\x00Sp\xd0\x00\x00\x00\x0b\x00\x00\x00\x05BP\x04@BR\x00\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 <- @flow(19) [next-incoming-id=1, 
incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, 
handle=1, delivery-count=1, link-credit=500, drain=false]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=0, 
delivery-tag=b"\x00\x00\x00\x00", message-format=0, settled=false, more=false] (70) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 <- @disposition(21) [role=true, first=0, last=0, 
settled=true, state=@accepted(36) []]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=0, last=0, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=1, 
delivery-tag=b"\x00\x00\x00\x01", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=2, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=2, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=1, last=1, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=2, 
delivery-tag=b"\x00\x00\x00\x02", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=3, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=3, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=2, last=2, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=3, 
delivery-tag=b"\x00\x00\x00\x03", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=4, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=4, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=3, last=3, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=4, 
delivery-tag=b"\x00\x00\x00\x04", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=5, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=5, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=4, last=4, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=5, 
delivery-tag=b"\x00\x00\x00\x05", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=6, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=6, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=5, last=5, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=6, 
delivery-tag=b"\x00\x00\x00\x06", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=7, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=7, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=6, last=6, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=7, 
delivery-tag=b"\x00\x00\x00\x07", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=8, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=8, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=7, last=7, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=8, 
delivery-tag=b"\x00\x00\x00\x08", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @flow(19) [next-incoming-id=9, 
incoming-window=2147483647, next-outgoing-id=1, outgoing-window=2147483647, 
handle=0, delivery-count=9, link-credit=9, drain=false]
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=8, last=8, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 <- @transfer(20) [handle=0, delivery-id=9, 
delivery-tag=b"\x00\x00\x00\x09", message-format=0, settled=false, more=false] (85) 
"\x00Sp\xc0\x06\x04BP\x04@A\x00Sr\xd1\x00\x00\x00\x07\x00\x00\x00\x02\xa1\x00@\x00Ss\xd0\x00\x00\x00"\x00\x00\x00\x0d@@@@@@@@\x83\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00@R\x00@\x00Sw\xa1\x0ctest
 message"
[0x55ee3ab25570]:0 -> @disposition(21) [role=true, first=9, last=9, 
settled=true, state=@modified(39) [delivery-failed=false, 
undeliverable-here=false]]
[0x55ee3ab25570]:0 -> @detach(22) [handle=0, closed=true]
[0x55ee3ab25570]:0 -> @close(24) []
[0x55ee3ab25570]:  -> EOS
[0x55ee3ab25570]:0 <- @detach(22) [handle=0, closed=true]
[0x55ee3ab25570]:0 <- @close(24) []
[0x55ee3ab25570]:  <- EOS


#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

from __future__ import print_function
import optparse
from proton import Message, Url
from proton.handlers import MessagingHandler
from proton.reactor import Container

class Recv(MessagingHandler):
    def __init__(self, url, count):
        super(Recv, self).__init__(auto_accept=False)
        self.url = Url(url)
        self.expected = count
        self.received = 0

    def on_start(self, event):
        conn = event.container.connect(self.url)
        event.container.create_receiver(conn, self.url.path)
        event.container.create_sender(conn, self.url.path).send(Message(body=u'test message'))

    def on_message(self, event):
        self.received += 1
        if self.received == self.expected:
            event.receiver.close()
            event.connection.close()
        self.release(event.delivery)

parser = optparse.OptionParser(usage="usage: %prog [options]")
parser.add_option("-a", "--address", default="localhost:5672/examples",
                  help="address from which messages are received (default %default)")
parser.add_option("-m", "--messages", type="int", default=10,
                  help="number of messages to receive; 0 receives indefinitely (default %default)")
opts, args = parser.parse_args()

try:
    Container(Recv(opts.address, opts.messages)).run()
except KeyboardInterrupt: pass




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to