Hello,
I'm using JMS and I've created a URL for automatic reconnection:
String amqpurl =
String.format("amqp://%s:%s@clientid/test?brokerlist='tcp://%s:%d?retries='%d'&connectdelay='%d''",
username, password, host, port, retries, connectdelay);
My code uses a mixture of synchronous sends/receives plus an asynchronous
MessageListener.
I've set up two separate Sessions on the Connection, one for the
request/response producer/consumers and one for the async consumer.
My aync Session has a number of MessageConsumers that consume from
"qmf.default.topic/agent.ind.event.#",
"qmf.default.topic/agent.ind.heartbeat.#"
My sync Session is used for synchronous request/response and has a
MessageProducer that writes to "qmf.default.direct" and a MessageConsumer
that reads from a pseudo-random address (used as a replyTo)
When I start up my application the MessageListener receives messages (QMF
Events and Heartbeats in this case) perfectly well.
However when I kill the broker and restart it I don't get any more messages,
despite the Connection being set up to automatically restart.
What's interesting though is if sometime before I kill the broker I fire a
message down my synchronous session along the lines of the following:
MapMessage request = syncSession.createMapMessage();
request.setJMSReplyTo(replyAddress);
request.setStringProperty("x-amqp-0-10.app-id", "qmf2");
request.setStringProperty("qmf.opcode", "_query_request");
request.setStringProperty("qpid.subject", "broker");
request.setObject("_what", "OBJECT");
request.setObject("_schema_id", new SchemaClassId(null, className, null,
null).mapEncode());
requester.send(request);
Message response = responder.receive(replyTimeout*1000);
List<Map> mapResults = buildListFromMessage(response);
for (Map content : mapResults) {
results.add(new QmfConsoleData(content, agent));
}
Bingo!! Now when I kill and restart the broker my MessageListener receives
all of the expected messages.
So what I'm really interested to know is why I need to send a message to
qmf.default.direct to have automatic Connection reconnects work.
BTW I do send a message down
"qmf.default.topic/console.request.agent_locate" but this wasn't enough.
It seems very odd to me and I'd love to know what's going on.
Funnily enough most of my client code actually fires off sync requests so
I've only just noticed this behaviour when I stripped back some client code
to create a test case.
Cheers,
Frase
--
View this message in context:
http://apache-qpid-users.2158936.n2.nabble.com/Can-anyone-explain-some-odd-automatic-reconnection-behaviour-tp6638769p6638769.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]