activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Teira <mte...@tid.es>
Subject QueueBridge and remote broker reconnections
Date Wed, 27 Sep 2006 13:48:16 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello.<br>
<br>
Looking at the code in <b>DestinationBridge</b>
(org.apache.activemq.network.jms), I see that when the deliver of a
message to the remote broker fails, there's a counter implemented as
the var 'attempt' that seems to be thought to mark fails and try to
restart the producer.<br>
<br>
But, shouldn't that variable be a member of the <b>DestinationBridge </b>class
instead of a local variable of the <b>onMessage </b>member method? In
this way, the var is always initialized to zero for every onMessage
call. So, restartProducer is never called:<br>
<br>
&nbsp;&nbsp;&nbsp; public void onMessage(Message message) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (started.get() &amp;&amp;
message != null) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int attempt = 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
try {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (attempt &gt; 0) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
restartProducer();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<br>
...<br>
<br>
In my tests, I've tryed changing the var 'attempt' to be an object
member. Now, restartProducer() is called but it seems that the new
connection is not being used. Looking at the code, I don't understand
how calling <br>
<br>
<tt>jmsConnector.restartProducerConnection()</tt><br>
<br>
<br>
is really changing the environment of <br>
<br>
<tt>createProducer()</tt><br>
<br>
in the <b>QueueBridge </b>subclass.<br>
<br>
For example, for the <b>QueueBridge </b>subclass, <b>createProducer </b>is
using the member <b>producerConnection</b>:<br>
<br>
<tt>&nbsp;&nbsp;&nbsp; protected MessageProducer createProducer() throws
JMSException{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
producerSession=producerConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; producer = producerSession.createSender(null);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return producer;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; </tt><br>
but I think that this is not related anymore with the JmsQueueConnector
outboundQueueConnection, that is the only affected member in
jmsConnector.restartProducerConnection(). I don't ever know how or who,
in the initialization is setting up the QueueBridge producerConnection
member, calling, I suppose, setProducerConnection. <br>
I think that a solution to this should be to be able to change the
producerConnection of QueueBridge when we are restarting the Producer.
But for that, we should need to implement&nbsp; restartProducer in the
DestinationBridge subclasses.<br>
<br>
<br>
Any hint or idea? I really need to have remote bridge reconnections
working urgently, so please, if you need further info, make me know.<br>
<br>
Regards.<br>
<br>
<br>
</body>
</html>

Mime
View raw message