It should take part in the XA transaction provided you enlist the XAResource.
Is there any reason you are not obtaining this via JNDI? If it is setup that way then the app server will handle the enlist.
I cannot obtain via JNDI because MySql db server host is not static i.e., Host address can be anything which i have to read from other application and it is configurable over there.
I think to enlist resources i have to use
In this case can you please help me how to get the JBoss Transaction manager and enlist it ? Do i need to take care of delisting ?
It will be more helpful if you can provide the sample code
You can obtain the TransactionManager instance from JNDI and use that to obtain the current Transaction instance. You can then enlist the resource obtained from the XAConnection.
You do not need to delist the resource.
You only need to delist the resource if you are finished with the work on that resource with that specific transaction, or you want to suspend the work and come back later (enlist again).