[ 
https://issues.apache.org/jira/browse/AMQ-3899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402229#comment-13402229
 ] 

Timothy Bish commented on AMQ-3899:
-----------------------------------

The XA variants create XA aware Connections, for local transactions you need to 
use the Non-XA versions of ConnectionFactory. 
                
> XAQueueConnectionFactory is not able to create normal QueueConnections
> ----------------------------------------------------------------------
>
>                 Key: AMQ-3899
>                 URL: https://issues.apache.org/jira/browse/AMQ-3899
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client
>    Affects Versions: 5.6.0
>            Reporter: Willem Jan Gerritsen
>
> The ActiveMQXAConnectionFactory has a method: QueueConnection 
> createQueueConnection(). This method returns an instance of 
> ActiveMQXAConnection.
> This connection cannot handle transacted sessions:
> {code}
> @Test
> public void create_message_producer_and_send() throws Exception {
>       XAQueueConnectionFactory xaqueueConnectionFactory = 
> (XAQueueConnectionFactory) 
> jmsContext.lookup(JMSProvider.XA_QUEUE_CONNECTION_FACTORY);
>       queueConnection = queueConnectionFactory.createQueueConnection();
>       queueConnection.start();
>       QueueSession queueSession = queueConnection.createQueueSession(true, 
> Session.AUTO_ACKNOWLEDGE);
>       MessageProducer producer = 
> queueSession.createProducer(queueSession.createQueue(queueName));
>       BytesMessage jmsMessage = queueSession.createBytesMessage();
>       jmsMessage.writeBytes("Hello world".getBytes());
>       producer.send(jmsMessage);
>       queueSession.commit(); // --> fail with TransactionInProgressException
> }
> {code}
> Our use-case is to instantiate a single queueconnectionfactory, which would 
> be able to provide both normal (transacted) and XA connections. So that when 
> we are sure that when we have only messaging in our transaction, that then we 
> don't need to bother about initiating an XA transaction.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to