Hi Manuel,
this looks like a good catch! Would mind opening a jira on this -
just so it's easier to track - I'll look at this as soon as I can
cheers,
Rob
On 27 Sep 2006, at 14:48, Manuel Teira wrote:
Hello.
Looking at the code in DestinationBridge
(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.
But, shouldn't that variable be a member of the DestinationBridge
class instead of a local variable of the onMessage member method?
In this way, the var is always initialized to zero for every
onMessage call. So, restartProducer is never called:
public void onMessage(Message message) {
if (started.get() && message != null) {
int attempt = 0;
try {
if (attempt > 0) {
restartProducer();
}
...
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
jmsConnector.restartProducerConnection()
is really changing the environment of
createProducer()
in the QueueBridge subclass.
For example, for the QueueBridge subclass, createProducer is using
the member producerConnection:
protected MessageProducer createProducer() throws JMSException{
producerSession=producerConnection.createQueueSession
(false,Session.AUTO_ACKNOWLEDGE);
producer = producerSession.createSender(null);
return producer;
}
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.
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
restartProducer in the DestinationBridge subclasses.
Any hint or idea? I really need to have remote bridge reconnections
working urgently, so please, if you need further info, make me know.
Regards.