R.Kaka
R.Kaka

Reputation: 167

HornetQ Queue has transaction timeout

I've used EJB to implement Command pattern. EJB is a command service that execute a business logic. I known in J2EE that EJB manage transaction and also transaction timeout.

<subsystem xmlns="urn:jboss:domain:transactions:1.1">
    <core-environment>
        <process-id>
            <uuid/>
        </process-id>
    </core-environment>
    <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
    <coordinator-environment default-timeout="600"/>
</subsystem>

As configuration I shown, transaction is managed and just allow maximum 600 seconds to process. Sometimes, my app take longer than 600 seconds to process to database, and right after that I try to send a message to a queue and I get this error.

21:34:50,085 ERROR [org.hornetq.ra.HornetQRASessionFactoryImpl] (Thread-102) Could not create session: javax.resource.ResourceException: IJ000460: Error checking for a transaction
    at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:362)
    at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
    at org.hornetq.ra.HornetQRASessionFactoryImpl.allocateConnection(HornetQRASessionFactoryImpl.java:837)
    at org.hornetq.ra.HornetQRASessionFactoryImpl.createQueueSession(HornetQRASessionFactoryImpl.java:237)
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_24]
Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffff0a01071e:2dde2ba2:5514d7c5:d1 status: ActionStatus.ABORTED >
    at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:352)
    ... 63 more

21:34:50,117 ERROR [stderr] (Thread-102) javax.jms.JMSException: Could not create a session: IJ000460: Error checking for a transaction

21:34:50,118 ERROR [stderr] (Thread-102)    at org.hornetq.ra.HornetQRASessionFactoryImpl.allocateConnection(HornetQRASessionFactoryImpl.java:881)

21:34:50,119 ERROR [stderr] (Thread-102)    at org.hornetq.ra.HornetQRASessionFactoryImpl.createQueueSession(HornetQRASessionFactoryImpl.java:237)

I can resolve it by increase transaction timeout value. But it's not a good solution. Anyone can tell me another way to do.

Upvotes: 1

Views: 1976

Answers (1)

Aparna Chaudhary
Aparna Chaudhary

Reputation: 1335

As a first step, try to divide the work load into smaller chunks - each relying on Container Managed Transactions.

If it is simply not feasible; then you can consider using Bean Managed Transactions.

Upvotes: 1

Related Questions