[ 
https://issues.apache.org/jira/browse/ARTEMIS-2742?focusedWorklogId=428535&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-428535
 ]

ASF GitHub Bot logged work on ARTEMIS-2742:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Apr/20 12:45
            Start Date: 29/Apr/20 12:45
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request 
#3104:
URL: https://github.com/apache/activemq-artemis/pull/3104#discussion_r417285683



##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java
##########
@@ -472,6 +473,96 @@ public void testRollbackError() throws Exception {
       }
    }
 
+   private void startXATransaction(Xid xid) throws Exception {
+      ClientProducer clientProducer = clientSession.createProducer(atestq);
+      ClientMessage sentMessage = createTextMessage(clientSession, "TEST");
+      clientProducer.send(sentMessage);
+      sentMessage.acknowledge();
+
+      clientSession.start(xid, XAResource.TMNOFLAGS);
+      clientSession.start();
+
+      ClientConsumer clientConsumer = clientSession.createConsumer(atestq);
+      ClientMessage receivedMessage = clientConsumer.receive(1000);
+      Assert.assertNotNull(receivedMessage);
+      receivedMessage.acknowledge();
+      Assert.assertEquals(receivedMessage.getBodyBuffer().readString(), 
"TEST");
+
+      clientSession.end(xid, XAResource.TMSUCCESS);
+   }
+
+   @Test
+   public void testPrepareOnWrongSession() throws Exception {
+      ClientSession clientSession2 = sessionFactory.createSession(true, false, 
false);
+
+      Xid xid = newXID();
+      startXATransaction(xid);
+
+      AssertionLoggerHandler.startCapture();
+      try {
+         clientSession2.prepare(xid);
+
+         assertTrue("Expected to find AMQ224105", 
AssertionLoggerHandler.findText("AMQ224105"));

Review comment:
       You cannot make this as a rule... 
   
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 428535)
    Time Spent: 20m  (was: 10m)

> Warn complete XA transaction on the wrong session
> -------------------------------------------------
>
>                 Key: ARTEMIS-2742
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2742
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Domenico Bruscino
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The broker allows starting a XA transaction on a session and completing the 
> same XA transaction on another session. This is helpful to solve recovery 
> situations and adding some warnings would make them easy to investigate.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to