Hello all,
I've noticed what I believe is odd behaviour with queue routes. Sorry it's a
bit long, but I wanted to cover all the steps I tried.
I'm using c++ broker 0.10.
Firstly I'll make it clear that I'm using a non-persistent queue on the
source broker so I realise that it won't automatically reconnect, but bear
with me, what I'm seeing seems odd to me......
So I've started from scratch with source broker localhost:5672 and
destination broker:5673
I fire up my consumer, which is consuming from the address:
consumer; {create: receiver, node: {x-declare: {arguments:
{'qpid.policy_type': ring, 'qpid.max_size': 500000000}}, x-bindings:
[{exchange: 'amq.match', queue: 'consumer', key: 'data1', arguments:
{x-match: all, data-service: amqp-delivery, item-owner: fadams}}]}}
I add the queue "federate" to the source broker by doing:
add queue federate --limit-policy=ring
and validate with qpid-config queues
I add a queue route between the brokers using:
qpid-route queue add localhost:5673 localhost:5672 amq.match federate
I then fire up my producer (which simply uses the address "federate") and
messages get delivered to my consumer as expected.
So far so good, everything works as expected. But I then kill the source
broker........
When I restart localhost:5672 I get the following message in the log
error Execution exception: not-found: Queue not found: federate
(qpid/broker/SessionAdapter.cpp:686)
This was expected as clearly the queue got zapped when I killed the broker.
When I check "qpid-route route map localhost:5673" I see
Static Routes:
localhost:5673(ex=amq.match) <= localhost:5672(queue=federate)
And qpid-route link list localhost:5673 I see
Host Port Transport Durable State Last Error
=============================================================================
localhost 5672 tcp N Operational Failed over to
tcp:169.254.8.127:5672
I then tried adding the federate queue again with:
qpid-config add queue federate --limit-policy=ring
And fire up the producer. It runs OK but no messages get delivered to the
consumer, so clearly the federated route doesn't attempt to retry if it
can't find the queue first time round.
So at this stage everything "looks" OK from what qpid-route is saying but
it's clearly not.
Next I try deleting the queue route with:
qpid-route queue del localhost:5673 localhost:5672 amq.match federate
but when I check with "qpid-route route map localhost:5673" I see
Static Routes:
localhost:5673(ex=amq.match) <= localhost:5672(queue=federate)
Which seems very odd to me. Similarly "qpid-route route flush
localhost:5673" has no effect.
Next I tried
qpid-route link del localhost:5673 localhost:5672
After this when I do "qpid-route route map localhost:5673" I see
Static Routes:
Failed: AttributeError - 'NoneType' object has no attribute 'host'
though "qpid-route link list localhost:5673" reports No Links Found
The broker logs had "closed by management" messages after I ran "link del"
which looks right.
So far so weird so it seems "qpid-route queue del" fails in this scenario.
So now I try to add the route again (remember the queue is up on the source
broker and there appear to be no links registered on the destination
broker!!).
qpid-route queue add localhost:5673 localhost:5672 amq.match federate
Failed: Exception - Duplicate Route - ignoring: amq.match(federate)
So what's that exception about!!! I deleted the link!!! and it was
previously reported as "No Links Found". There were no broker messages when
I ran this BTW - oh and still no messages delivered :-(
When I do "qpid-route route map localhost:5673" I see
Static Routes:
localhost:5673(ex=amq.match) <= localhost:5672(queue=federate)
And qpid-route link list localhost:5673
Host Port Transport Durable State Last Error
=============================================================================
localhost 5672 tcp N Operational
So there's nothing telling me I have any problems (other than of course no
messages being delivered to my consumer)
Finally I delete the queue on the source broker and then attempt to delete
the route
qpid-config del queue federate --force
qpid-route queue del localhost:5673 localhost:5672 amq.match federate
This time qpid-route route map localhost:5673 lists
Static Routes:
none found
Now when I do:
qpid-config add queue federate --limit-policy=ring
qpid-route queue add localhost:5673 localhost:5672 amq.match federate
At last messages start flowing again :-)
So in precis it looks like the queue route ends up in a fairly messy state
when established (or in this case re-established) when the source queue
isn't available.
To check this I deleted the route and deleted the queue and manually tried
qpid-route queue add localhost:5673 localhost:5672 amq.match federate
There was no error from qpid-route but the broker gave the message
error Execution exception: not-found: Queue not found: federate
(qpid/broker/SessionAdapter.cpp:686)
As before.
I again added the queue and got back to the state previously.
So it very much appears that queue routes don't like to be established
without the queue being present and if the queue is subsequently added the
route can't get cleanly deleted. This means that if the source broker dies
on a queue route with a non-persistent queue one has to be careful to
explicitly delete the route before adding the queue again then re-adding the
route.
It would be really nice to have some errors from qpid-route about the weird
inconsistent state, it's not great that everything *looks* OK when clearly
it isn't.
It would be even nicer if routes could re-try until the queue becomes
available. I realise that things work if I use a durable queue (I did
actually try that), however in my application I don't really want to use a
durable queue as I don't want the performance cost of persistence. Ideally
I'd like to persist the queue *configuration* as opposed to having a
persistent queue, but there's no way to do that with the c++ broker as far
as I'm aware.
I guess using the "-s" option with qpid-route is the safest thing to do in
my case as then the link is maintained on the source broker so that'll get
zapped at the same time as my queue so I won't have to remember to delete
the route.
Any thoughts on this behaviour?
Cheers,
Frase
--
View this message in context:
http://apache-qpid-users.2158936.n2.nabble.com/federation-queue-routes-to-headers-exchange-have-odd-behaviour-after-source-broker-restart-tp6945190p6945190.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]