You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jschmied <na...@juergenschmied.de> on 2010/02/19 23:27:10 UTC

Bridging not working reliable

H!

I'm trying to use a Bridge to Oracle JMS. 

I have a embeded Broker with a local persistant Queue and a bridge to
Oracle. If all systems are fine, no problems.

-------------
BrokerService broker = new BrokerService();

JmsQueueConnector jmsQueueConnector = new JmsQueueConnector();
QueueConnection createQueueConnection = new
QueueConnectionWrap(queueConnectionFactory.createQueueConnection());

createQueueConnection.start();

jmsQueueConnector.setOutboundQueueConnection(createQueueConnection);

OutboundQueueBridge outboundQueueBridge = new
OutboundQueueBridge("DEV_MSGQ");
outboundQueueBridge.setLocalQueueName("SUBJECT");
jmsQueueConnector.setOutboundQueueBridges(new OutboundQueueBridge[] {
outboundQueueBridge });

broker.setJmsBridgeConnectors(new JmsConnector[] { jmsQueueConnector });
broker.setBrokerName("fred");
broker.setPersistent(true);
broker.start();
---------

The problems coming when the Oracle Server goes down:

The Sender of the Queue does not try to reconnect.

I wraped the QueueConnection/QueueSession/Sender and now a Exception in
Sender.sendMessage() gets a new QueueSession, a new Queue and a new Sender
so I can reconnect.

If my reconnection its not successful an I throw a Exception in
Sender.sendMessage, the message is removed from the Queue anyway and its
lost:

2010-02-19 22:50:21,843 ERROR DestinationBridge    onMessage         -
failed to forward message on attempt: 1 reason: oracle.jms.AQjmsException:
I/O Exception: The Network Adapter could not establish the connection
message: ActiveMQTextMessage {commandId = 82, responseRequired = false,
messageId = ID:NBK092-1401-1266616208578-2:1:1:20:1, originalDestination =
null, originalTransactionId = null, producerId =
ID:NBK092-1401-1266616208578-2:1:1:20, destination = queue://SUBJECT,
transactionId = TX:ID:NBK092-1401-1266616208578-2:1:20, expiration = 0,
timestamp = 1266616216390, arrival = 0, brokerInTime = 1266616216390,
brokerOutTime = 1266616216468, correlationId = null, replyTo = null,
persistent = true, type = null, priority = 4, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1032, properties = null, readOnlyProperties = true, readOnlyBody =
true, droppable = false, text = TEST}
oracle.jms.AQjmsException: I/O Exception: The Network Adapter could not
establish the connection
	at
oracle.jms.AQjmsDBConnMgr.checkForSecurityException(AQjmsDBConnMgr.java:934)
	at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:609)
	at oracle.jms.AQjmsConnection.createQueueSession(AQjmsConnection.java:646)
	at org.test.QueueSessionWrap.reconnect(QueueSessionWrap.java:473)
	at org.test.QueueSenderWrap.send(QueueSenderWrap.java:186)
	at
org.apache.activemq.network.jms.QueueBridge.sendMessage(QueueBridge.java:80)
	at
org.apache.activemq.network.jms.DestinationBridge.onMessage(DestinationBridge.java:130)
	at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1088)
	at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:127)
	at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:197)
	at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
	at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLRecoverableException: I/O Exception: The Network
Adapter could not establish the connection
	at
oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)
	at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:458)
	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
	at
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
	at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
	at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:207)
	at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:575)
	... 13 more

The Message ID:NBK092-1401-1266616208578-2:1:1:20:1 is lost now. The Bridge
should roll this transaction  back.


What can I do?

Thanks

Juergen

-- 
View this message in context: http://old.nabble.com/Bridging-not-working-reliable-tp27661175p27661175.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Bridging not working reliable

Posted by Rob Davies <ra...@gmail.com>.
thanks for the patch!
On 20 Feb 2010, at 22:02, jschmied wrote:

>
> I did need it, so I fixed it.
>
> See:
> https://issues.apache.org/activemq/browse/AMQ-2455
>
> -- 
> View this message in context: http://old.nabble.com/Bridging-not-working-reliable-tp27661175p27670889.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/






Re: Bridging not working reliable

Posted by jschmied <na...@juergenschmied.de>.
I did need it, so I fixed it.

See:
https://issues.apache.org/activemq/browse/AMQ-2455

-- 
View this message in context: http://old.nabble.com/Bridging-not-working-reliable-tp27661175p27670889.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.