1

I have an Inbound Resource Adapter that is configured in the jboss 7.1 EAP under the subsystem urn:jboss:domain:resource-adapters:5.0 with transaction-support set to XATransaction. This resource adapter is bounded to listen to an IP and port. Upon receiving a message a work is scheduled using javax.resource.spi.work.WorkManager which at the end of processing a message will deliver the message to a queue configured Jboss. First message alone is successfully delivered to the queue after processing, for rest of the messages WorkException is thrown (javax.resource.spi.work.WorkCompletedException: ARJUNA032020: Transaction is completing!, error code: 2). The same piece of code works in Jboss 5.1 GA and Jboss 6.3 EAP.

I have tried to set other transaction-support types like NoTransaction,LocalTransaction in the resource adapter subsystem. tried to update the jboss-j2ee jar from 4.0.4.GA to other versions like 4.2.3.GA, wildfly-client-all (version:7.1.0.GA-redhat-11). But it didn't work. The same RA adapter works in other JBoss versions like 5.1 GA and 6.3 EAP.

PipelineContext is our own class that contains Inbound listener properties like host,port to which RA must listen etc.

public class T24Context extends PipelineContext {
private WorkManager workManager = null;                                                     
private XATerminator xaTerminator = null;                                                               
private Map<Integer, ExecutionContext> executionContexts = new HashMap<Integer, ExecutionContext>();
private List<EndpointAdapter> endpoints = new ArrayList<EndpointAdapter>();
}

Below is the sample code where the actual work manager calls the startWork() method before which ResourceAdapter.start() is called, the provided BootstrapContext contains a XATerminator that is set. Also custom XID implementation is done which is set in the ExecutionContext and the same is passed to WorkManager.

T24Context context = (T24Context) pipelineContext;
WorkManager wm = context.getWorkManager(); 
if (wm != null) {
    ExecutionContext ec = null;
    if (transactionId != null) {
        ec = context.getExecutionContext(channelId);
    }
WorkListener wl = getWorkListener();
wm.startWork(this, WORK_START_TIMEOUT, ec, wl);
} else {
run();
}



@Override
    public void run() {
        try {
            if (_endpoints != null) {
                for (EndpointAdapter adapter : _endpoints) {
                    _response = adapter.process(_activation, _message);
                }    
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Exception in processing request", e);
        }
    }

process method will create an MessageEndPoint like MessageEndpoint mep = endpointFactory.createEndpoint(null); which will then be used to call an MDB that will deliver the message to the queue.

Expected result is that if 10 messages are pushed into TCP port the same must be delivered to the queue via an inbound Resource adapter that listens to the mentioned TCP port. This happens in Jboss 5.1 GA and 6.3 EAP but not in 7.1 EAP

Actual result is that after the first message is posted to the queue we are getting the below mentioned exception and the rest of the messages results in the same error:

Stack Trace :

javax.resource.spi.work.WorkCompletedException: ARJUNA032020: Transaction is completing!, error code: 2
    at com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator.registerWork(XATerminator.java:107)
    at org.jboss.as.txn.integration.JBossContextXATerminator.registerWork(JBossContextXATerminator.java:103)
    at org.jboss.jca.core.tx.jbossts.XATerminatorImpl.registerWork(XATerminatorImpl.java:102)
    at org.jboss.jca.core.workmanager.WorkWrapper.start(WorkWrapper.java:299)
    at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:217)
    at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
    at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
    at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
    at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:828)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)

0 Answers0