Adel,

I don't know what your use case is, but at the risk of creating more confusion I will mention that using link-routing to a broker through a router network has very different behavior.

With link-routing, there is no prefetch and the routers don't do any load balancing. The links are attached from consumer to broker through the router network. Credit is handled by each side normally. If the consumer detaches or drops, all of its in-flight deliveries will be released to the broker and held there until another consumer appears.

-Ted

On 02/24/2017 10:58 AM, Adel Boutros wrote:
That's perfectly clear! In our use cases, the default behavior will be enough 
for now.


Thanks,

Adel

________________________________
From: Ted Ross <[email protected]>
Sent: Friday, February 24, 2017 11:52:37 AM
To: [email protected]
Subject: Re: [Qpid Dispatch] Message States on Web Management Console of Qpid 
Java Broker

Sorry Adel, I should have been more clear.  I meant that it might be
possible to design and code a new feature for the router to allow it to
revoke and release when the last consumer is gone from the network.

I don't think this would be the desirable default behavior however.  It
would only be useful if there were consumers on the broker that access
the broker directly and not through the router network.  If all the
consumers access the broker through the routers, the current behavior is
more efficient.

-Ted

On 02/24/2017 09:01 AM, Adel Boutros wrote:
Thank you Ted for your clarifications. However, there is still something 
confusing:


You said "It might be possible for the router to revoke credit and release all of 
its prefetched deliveries once it becomes aware that there are no more consumers in the 
network".


However, this is not what we are experiencing as the dispatch router is still 
fetching newly sent messages after all consumers have been closed on the 
dispatch router (So no consumers are connected to it) which contradicts the 
previous hypothesis, no?


What triggers the "it might"?


Regards,

Adel

________________________________
From: Ted Ross <[email protected]>
Sent: Thursday, February 23, 2017 9:48:32 PM
To: [email protected]
Subject: Re: [Qpid Dispatch] Message States on Web Management Console of Qpid 
Java Broker


On 02/23/2017 05:52 PM, Adel Boutros wrote:
Hello Ted,


What we tested shows that once credit has been made available to the dispatch 
router, it remains even if no more consumers are connected to it. So as 
Anouchka said any new message sent to the broker is being taken by the dispatch 
router which has no consumer. So no other valid consumer on the broker can 
consume it.


Our questions:

* Do you confirm this behavior is a bug because the dispatch router should only 
consume when a valid peer is connected to it?

This behavior is not a bug.  The router is designed to prefetch a number
of deliveries from the broker once there is at least one consumer.  This
prefetch is the link-capacity of the broker connection (defaults to
250).  It might be possible for the router to revoke credit and release
all of its prefetched deliveries once it becomes aware that there are no
more consumers in the network.  This would allow the broker to deliver
those messages to other directly connected consumers.

If you are designing a system in which the router network is one of
multiple consumers on a broker's queue, you will have to deal with the
prefetch issue.  It is not practical for the router network to propagate
real-time credit information across the routers (i.e. issue only enough
credit to the broker to match downrange consumer credit).


* What happens if the broker goes down? Does a consumer connected to the 
dispatch router still receives the message as it is currently in the dispatch 
router's memory?

If the broker goes down, any undelivered messages prefetched by the
router shall be dropped and never delivered.  Any prefetched messages
that have been routed to a destination shall continue to be delivered
but will be in-doubt in the broker if they are durable.



Regards,

Adel

________________________________
From: Ted Ross <[email protected]>
Sent: Thursday, February 23, 2017 6:09:40 PM
To: [email protected]
Subject: Re: [Qpid Dispatch] Message States on Web Management Console of Qpid 
Java Broker

Actually, the router does not send the messages back to the broker.  It
only sends back dispositions (modified, delivery-failed=true).  The
transfers that you noted as going back to the broker are actually the
broker resending the messages to the router (The <- arrow direction
denotes incoming deliveries from the router's perspective).

-Ted

On 02/23/2017 04:01 PM, Anouchka El Asmar wrote:
Hello,

As advised, I tried tracing the connection between the router and the
broker. I worte this simple code that sends and receive a message:

Connection connection = null;
try {
    ConnectionFactory connectionFactory = new
JmsConnectionFactory("amqp://localhost:10501");
    connection = connectionFactory.createConnection();
    Session session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
    Queue destination = session.createQueue("queue");
    MessageProducer producer = session.createProducer(destination);
    connection.start();
    TextMessage message = session.createTextMessage("Hello Adoul!");

    producer.send(message);
    MessageConsumer consumer = session.createConsumer(destination);

    TextMessage received = (TextMessage) consumer.receive();

    consumer.close();

} catch (JMSException e) {
    e.printStackTrace();
} finally {
    if (connection != null)
        connection.close();
}


All the messages are directly acquired by the dispatch router and when
I close the connection, it resends them to the broker.

Also, any new message sent direclty to the broker (not through the
dispatch router) will be directly acquired by the dispatch router.


Please find below the trace output,

Regards,

Anouchka


Accepted from localhost:58368

[0x7fd3c802d5b0]:  <- SASL

[0x7fd3c802d5b0]:  -> SASL

[0x7fd3c802d5b0]:0 -> @sasl-mechanisms(64)
[sasl-server-mechanisms=@PN_SYMBOL[:ANONYMOUS]]

[0x7fd3c802d5b0]:0 <- @sasl-init(65) [mechanism=:ANONYMOUS,
initial-response=b"", hostname="localhost"]

[0x7fd3c802d5b0]:0 -> @sasl-outcome(68) [code=0]

[0x7fd3c802d5b0]:  <- AMQP

[0x7fd3c802d5b0]:0 <- @open(16)
[container-id="ID:a4e877d7-92e6-44e2-b2be-563ee0c63295:1",
hostname="localhost", max-frame-size=1048576, channel-max=32767,
idle-time-out=30000,
desired-capabilities=@PN_SYMBOL[:"sole-connection-for-container"],
properties={:product="QpidJMS", :version="0.11.1", :platform="JVM:
1.7.0_79, 24.79-b02, Oracle Corporation, OS: Windows 7, 6.1, amd64"}]

[0x7fd3c802d5b0]:  -> AMQP

[0x7fd3c802d5b0]:0 -> @open(16) [container-id="router.10501",
max-frame-size=16384, channel-max=32767, idle-time-out=8000,
offered-capabilities=:"ANONYMOUS-RELAY",
properties={:product="qpid-dispatch-router", :version="0.7.0"}]

[0x7fd3c802d5b0]:0 <- @begin(17) [next-outgoing-id=1, incoming-window=2047,
outgoing-window=2147483647, handle-max=65535]

[0x7fd3c802d5b0]:0 -> @begin(17) [remote-channel=0, next-outgoing-id=0,
incoming-window=61, outgoing-window=2147483647]

[0x7fd3c802d5b0]:1 <- @begin(17) [next-outgoing-id=1, incoming-window=2047,
outgoing-window=2147483647, handle-max=65535]

[0x7fd3c802d5b0]:1 -> @begin(17) [remote-channel=1, next-outgoing-id=0,
incoming-window=61, outgoing-window=2147483647]

[0x7fd3c802d5b0]:1 <- @attach(18)
[name="qpid-jms:sender:ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1:adelQueue",
handle=0, role=false, snd-settle-mode=0, rcv-settle-mode=0,
source=@source(40)
[address="ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1", durable=0,
expiry-policy=:"session-end", timeout=0, dynamic=false,
outcomes=@PN_SYMBOL[:"amqp:accepted:list", :"amqp:rejected:list"]],
target=@target(41) [address="adelQueue", durable=0,
expiry-policy=:"session-end", timeout=0, dynamic=false,
capabilities=@PN_SYMBOL[:queue]], incomplete-unsettled=false,
initial-delivery-count=0]

[0x7fd3c802d5b0]:1 -> @attach(18)
[name="qpid-jms:sender:ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1:adelQueue",
handle=0, role=true, snd-settle-mode=2, rcv-settle-mode=0,
source=@source(40)
[address="ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1", durable=0,
timeout=0, dynamic=false, outcomes=@PN_SYMBOL[:"amqp:accepted:list",
:"amqp:rejected:list"]], target=@target(41) [address="adelQueue",
durable=0, timeout=0, dynamic=false, capabilities=@PN_SYMBOL[:queue]],
initial-delivery-count=0, max-message-size=0]

[0x7fd3c802d5b0]:1 -> @flow(19) [next-incoming-id=1, incoming-window=61,
next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=0,
link-credit=250, drain=false]

[0x1b80b90]:0 <- (EMPTY FRAME)

[0x1b80b90]:0 <- (EMPTY FRAME)

[0x1b80b90]:0 <- (EMPTY FRAME)
*Here it sends the message*
[0x7fd3c802d5b0]:1 <- @transfer(20) [handle=0, delivery-id=0,
delivery-tag=b"0", message-format=0] (152)
"\x00Sp\xc0\x02\x01A\x00Sr\xc1)\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkJ\xc7\x86\x00Sw\xa1\x0cHello
Adoul!"

[0x1b80b90]:1 -> @transfer(20) [handle=0, delivery-id=0,
delivery-tag=b"\x04\x00\x00\x00\x00\x00\x00\x00", message-format=0,
settled=false, more=false] (158)
"\x00Sp\xc0\x02\x01A\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkJ\xc7\x86\x00Sw\xa1\x0cHello
Adoul!"

[0x1b80b90]:1 <- @disposition(21) [role=true, first=0, last=0,
settled=true, state=@accepted(36) []]

[0x7fd3c802d5b0]:1 -> @flow(19) [next-incoming-id=2, incoming-window=61,
next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=1,
link-credit=250, drain=false]

[0x7fd3c802d5b0]:1 -> @disposition(21) [role=true, first=0, last=0,
settled=true, state=@accepted(36) []]

[0x7fd3c802d5b0]:1 <- @attach(18)
[name="qpid-jms:receiver:ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1:adelQueue",
handle=1, role=true, snd-settle-mode=0, rcv-settle-mode=0,
source=@source(40) [address="adelQueue", durable=0,
expiry-policy=:"link-detach", timeout=0, dynamic=false,
default-outcome=@modified(39) [delivery-failed=true],
outcomes=@PN_SYMBOL[:"amqp:accepted:list", :"amqp:rejected:list",
:"amqp:released:list", :"amqp:modified:list"],
capabilities=@PN_SYMBOL[:queue]], target=@target(41) []]

[0x1b80b90]:0 -> @flow(19) [next-incoming-id=0, incoming-window=15,
next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=0,
link-credit=250, drain=false]

[0x7fd3c802d5b0]:1 -> @attach(18)
[name="qpid-jms:receiver:ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1:adelQueue",
handle=1, role=false, snd-settle-mode=2, rcv-settle-mode=0,
source=@source(40) [address="adelQueue", durable=0,
expiry-policy=:"link-detach", timeout=0, dynamic=false,
outcomes=@PN_SYMBOL[:"amqp:accepted:list", :"amqp:rejected:list",
:"amqp:released:list", :"amqp:modified:list"],
capabilities=@PN_SYMBOL[:queue]], target=@target(41) [durable=0, timeout=0,
dynamic=false], initial-delivery-count=0, max-message-size=0]

[0x1b80b90]:0 <- @transfer(20) [handle=0, delivery-id=0,
delivery-tag=b"\x00\x00\x00\x00\x00\x00\x00\x00", message-format=0] (163)
"\x00Sp\xc0\x07\x05A@
@@R\x04\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:44cb79a5-ae8e-40b7-a930-1f55ba6b3c6a:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkFN\x01\x00Sw\xa1\x0cHello Adoul!"

[0x1b80b90]:0 <- @transfer(20) [handle=0, delivery-id=1,
delivery-tag=b"\x00\x00\x00\x00\x00\x00\x00\x01", message-format=0] (163)
"\x00Sp\xc0\x07\x05A@
@@R\x02\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:3d7b3b47-f399-4428-867a-11a18d92f08c:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkG\x7f\x05\x00Sw\xa1\x0cHello
Adoul!"

[0x1b80b90]:0 <- @transfer(20) [handle=0, delivery-id=2,
delivery-tag=b"\x00\x00\x00\x00\x00\x00\x00\x02", message-format=0] (158)
"\x00Sp\xc0\x02\x01A\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkJ\xc7\x86\x00Sw\xa1\x0cHello
Adoul!"

[0x1b80b90]:0 <- (EMPTY FRAME)

[0x1b80b90]:0 <- (EMPTY FRAME)

[0x1b80b90]:0 <- (EMPTY FRAME)
*Here it receives it*
[0x7fd3c802d5b0]:1 <- @flow(19) [next-incoming-id=0, incoming-window=2047,
next-outgoing-id=2, outgoing-window=2147483647, handle=1, delivery-count=0,
link-credit=1000]

[0x7fd3c802d5b0]:1 -> @transfer(20) [handle=1, delivery-id=0,
delivery-tag=b"\x05\x00\x00\x00\x00\x00\x00\x00", message-format=0,
settled=false, more=false] (163) "\x00Sp\xc0\x07\x05A@
@@R\x04\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:44cb79a5-ae8e-40b7-a930-1f55ba6b3c6a:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkFN\x01\x00Sw\xa1\x0cHello Adoul!"

[0x7fd3c802d5b0]:1 -> @transfer(20) [handle=1, delivery-id=1,
delivery-tag=b"\x06\x00\x00\x00\x00\x00\x00\x00", message-format=0,
settled=false, more=false] (163) "\x00Sp\xc0\x07\x05A@
@@R\x02\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:3d7b3b47-f399-4428-867a-11a18d92f08c:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkG\x7f\x05\x00Sw\xa1\x0cHello
Adoul!"

[0x7fd3c802d5b0]:1 -> @transfer(20) [handle=1, delivery-id=2,
delivery-tag=b"\x07\x00\x00\x00\x00\x00\x00\x00", message-format=0,
settled=false, more=false] (158)
"\x00Sp\xc0\x02\x01A\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkJ\xc7\x86\x00Sw\xa1\x0cHello
Adoul!"

[0x1b80b90]:0 <- (EMPTY FRAME)

[0x7fd3c802d5b0]:0 <- (EMPTY FRAME)

[0x7fd3c802d5b0]:1 <- @detach(22) [handle=1, closed=true]

[0x7fd3c802d5b0]:1 -> @detach(22) [handle=1, closed=true]
*Then the consumer is closed*
[0x1b80b90]:0 -> @flow(19) [next-incoming-id=3, incoming-window=15,
next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=3,
link-credit=248, drain=false]

[0x1b80b90]:0 -> @disposition(21) [role=true, first=0, last=0,
settled=true, state=@modified(39) [delivery-failed=true,
undeliverable-here=false]]

[0x1b80b90]:0 -> @disposition(21) [role=true, first=1, last=1,
settled=true, state=@modified(39) [delivery-failed=true,
undeliverable-here=false]]

[0x1b80b90]:0 -> @disposition(21) [role=true, first=2, last=2,
settled=true, state=@modified(39) [delivery-failed=true,
undeliverable-here=false]]

[0x1b80b90]:0 -> @flow(19) [next-incoming-id=3, incoming-window=15,
next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=3,
link-credit=250, drain=false]
*Then it resends the message back to the broker*
[0x1b80b90]:0 <- @transfer(20) [handle=0, delivery-id=3,
delivery-tag=b"\x00\x00\x00\x00\x00\x00\x00\x03", message-format=0] (163)
"\x00Sp\xc0\x07\x05A@
@@R\x05\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:44cb79a5-ae8e-40b7-a930-1f55ba6b3c6a:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkFN\x01\x00Sw\xa1\x0cHello Adoul!"

[0x1b80b90]:0 <- @transfer(20) [handle=0, delivery-id=4,
delivery-tag=b"\x00\x00\x00\x00\x00\x00\x00\x04", message-format=0] (163)
"\x00Sp\xc0\x07\x05A@
@@R\x03\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:3d7b3b47-f399-4428-867a-11a18d92f08c:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkG\x7f\x05\x00Sw\xa1\x0cHello
Adoul!"

[0x1b80b90]:0 <- @transfer(20) [handle=0, delivery-id=5,
delivery-tag=b"\x00\x00\x00\x00\x00\x00\x00\x05", message-format=0] (163)
"\x00Sp\xc0\x07\x05A@
@@R\x01\x00Sr\xd1\x00\x00\x00,\x00\x00\x00\x04\xa3\x12x-opt-jms-msg-typeQ\x05\xa3\x0ex-opt-jms-destQ\x00\x00Ss\xc0M\x0a\xa1/ID:1e147351-49a8-4f50-a90b-f1b9bf4abd21:1:1:1-1@
\xa1\x09adelQueue@@@@@@\x83\x00\x00\x01ZkJ\xc7\x86\x00Sw\xa1\x0cHello
Adoul!"

[0x7fd3c802d5b0]:1 <- @disposition(21) [role=true, first=0, last=0,
settled=true, state=@modified(39) [delivery-failed=true]]

[0x7fd3c802d5b0]:1 <- @disposition(21) [role=true, first=1, last=1,
settled=true, state=@released(38) []]

[0x7fd3c802d5b0]:1 <- @disposition(21) [role=true, first=2, last=2,
settled=true, state=@released(38) []]

[0x7fd3c802d5b0]:0 <- @close(24) []

[0x7fd3c802d5b0]:  <- EOS

[0x7fd3c802d5b0]:0 -> @close(24) []

[0x7fd3c802d5b0]:  -> EOS

Closed localhost:58368

On Wed, Feb 22, 2017 at 7:23 PM, Ted Ross <[email protected]> wrote:

Hi Anouchka,

I assume what is happening in the dispatch router case is that the message
does in fact go back to AVAILABLE state, but since the connection between
the router and broker is still up (and there is still credit for transfer),
the message is immediately re-sent to the router where is waits until there
is another consumer to take the delivery.

Tracing the connection between the broker and router would confirm (or
negate) this theory.

-Ted


On 02/22/2017 05:09 PM, Anouchka El Asmar wrote:

Hello,

I am sending messages to a broker with client acknowledge mode and
checking
the different states of the messages. I realized that when a consumer
receives a message, it sets the message state to ACQUIRED and when you
close the consumer without acknowledging it, it releases the message and
sets it back to AVAILABLE. Another consumer can receive it afterwards.

When I repeat the same scenario with the dispatch router connected to the
broker, the message is always in ACQUIRED state.

Why don't you have the same behavior in both cases?

Qpid Dispatch 0.7
Qpid Broker 6.0.4

Regards,
Anouchka


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




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



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



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



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

Reply via email to