[jira] [Commented] (TOMEE-2229) JMSContext Injected by TomEE does not participate in JTA, or at least sends messages immediately
[ https://issues.apache.org/jira/browse/TOMEE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16918776#comment-16918776 ] Jonathan S Fisher commented on TOMEE-2229: -- Fixed: https://github.com/apache/tomee/commit/3780eb6008ea3369ab745d0c1d7af718664323be > JMSContext Injected by TomEE does not participate in JTA, or at least sends > messages immediately > > > Key: TOMEE-2229 > URL: https://issues.apache.org/jira/browse/TOMEE-2229 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.5, 7.0.6, 7.1.1, 8.0.0-M3 >Reporter: Jonathan S Fisher >Assignee: Jonathan S Fisher >Priority: Critical > > Hey guys, > We noticed that if you have a JMSContext in a transaction EJB or CDI Bean, it > always sends messages immediately instead of waiting for the XA to commit. > We found this by injecting a JMSContext into an MDB marked with > TransactionAttribute(Required), calling the jmsContext.createProducer() > method, sending some messages, then sleeping the original MDB thread for > several seconds. The messages arrive at their destinations immediately, long > before the MDB thread wakes up and the XA transaction completes. > Is there a chance our understanding is not correct? > According to the docs: > {quote}If the injected JMSContext is used in a JTA transaction (whether > container-managed or bean-managed), the JMSContext is considered to have > transaction scope. This means that after the JTA transaction is committed, > the JMSContext will be automatically closed.{quote} > References: > * https://www.oracle.com/technetwork/articles/java/jms20-1947669.html -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (TOMEE-2229) JMSContext Injected by TomEE does not participate in JTA, or at least sends messages immediately
[ https://issues.apache.org/jira/browse/TOMEE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16616344#comment-16616344 ] Jonathan S Fisher commented on TOMEE-2229: -- So I *did* get this to partially work with Romain's configuration by specifying a brokerUrl and having multiple JMSConnectionFactory's defined in tomee.xml, then overriding the connection factory selection with `@JMSConnectionFactory` at the top of the class. Phew. TomEE is most certainly behaving out of spec though, it looks as JMSContext is definitely supposed to auto-join the ongoing XA: https://docs.oracle.com/javaee/7/tutorial/jms-concepts005.htm The other bug is with the TomEEXAConnectionFactory itself... It would be really nice if it could point to a resource adapter rather than straight to a broker url. Not a huge dealbreaker, but for consistency of configuration, that'd be nice. > JMSContext Injected by TomEE does not participate in JTA, or at least sends > messages immediately > > > Key: TOMEE-2229 > URL: https://issues.apache.org/jira/browse/TOMEE-2229 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.5 >Reporter: Jonathan S Fisher >Priority: Critical > > Hey guys, > We noticed that if you have a JMSContext in a transaction EJB or CDI Bean, it > always sends messages immediately instead of waiting for the XA to commit. > We found this by injecting a JMSContext into an MDB marked with > TransactionAttribute(Required), calling the jmsContext.createProducer() > method, sending some messages, then sleeping the original MDB thread for > several seconds. The messages arrive at their destinations immediately, long > before the MDB thread wakes up and the XA transaction completes. > Is there a chance our understanding is not correct? > According to the docs: > {quote}If the injected JMSContext is used in a JTA transaction (whether > container-managed or bean-managed), the JMSContext is considered to have > transaction scope. This means that after the JTA transaction is committed, > the JMSContext will be automatically closed.{quote} > References: > * https://www.oracle.com/technetwork/articles/java/jms20-1947669.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TOMEE-2229) JMSContext Injected by TomEE does not participate in JTA, or at least sends messages immediately
[ https://issues.apache.org/jira/browse/TOMEE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598936#comment-16598936 ] Jonathan S Fisher commented on TOMEE-2229: -- [~romain.manni-bucau] Yes, when you do that, it seems to ignore the resource adapter configuration and instead does this: {quote} 31-Aug-2018 10:53:37.249 WARNING [ActiveMQ Task-1] org.apache.activemq.transport.failover.FailoverTransport.doReconnect Failed to connect to [tcp://localhost:61616] after: 10 attempt(s) continuing to retry. {quote} > JMSContext Injected by TomEE does not participate in JTA, or at least sends > messages immediately > > > Key: TOMEE-2229 > URL: https://issues.apache.org/jira/browse/TOMEE-2229 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.5 >Reporter: Jonathan S Fisher >Priority: Critical > > Hey guys, > We noticed that if you have a JMSContext in a transaction EJB or CDI Bean, it > always sends messages immediately instead of waiting for the XA to commit. > We found this by injecting a JMSContext into an MDB marked with > TransactionAttribute(Required), calling the jmsContext.createProducer() > method, sending some messages, then sleeping the original MDB thread for > several seconds. The messages arrive at their destinations immediately, long > before the MDB thread wakes up and the XA transaction completes. > Is there a chance our understanding is not correct? > According to the docs: > {quote}If the injected JMSContext is used in a JTA transaction (whether > container-managed or bean-managed), the JMSContext is considered to have > transaction scope. This means that after the JTA transaction is committed, > the JMSContext will be automatically closed.{quote} > References: > * https://www.oracle.com/technetwork/articles/java/jms20-1947669.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TOMEE-2229) JMSContext Injected by TomEE does not participate in JTA, or at least sends messages immediately
[ https://issues.apache.org/jira/browse/TOMEE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598923#comment-16598923 ] Romain Manni-Bucau commented on TOMEE-2229: --- did you try the mentionned config: {code:java} ResourceAdapter=ra/activemq {code} > JMSContext Injected by TomEE does not participate in JTA, or at least sends > messages immediately > > > Key: TOMEE-2229 > URL: https://issues.apache.org/jira/browse/TOMEE-2229 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.5 >Reporter: Jonathan S Fisher >Priority: Critical > > Hey guys, > We noticed that if you have a JMSContext in a transaction EJB or CDI Bean, it > always sends messages immediately instead of waiting for the XA to commit. > We found this by injecting a JMSContext into an MDB marked with > TransactionAttribute(Required), calling the jmsContext.createProducer() > method, sending some messages, then sleeping the original MDB thread for > several seconds. The messages arrive at their destinations immediately, long > before the MDB thread wakes up and the XA transaction completes. > Is there a chance our understanding is not correct? > According to the docs: > {quote}If the injected JMSContext is used in a JTA transaction (whether > container-managed or bean-managed), the JMSContext is considered to have > transaction scope. This means that after the JTA transaction is committed, > the JMSContext will be automatically closed.{quote} > References: > * https://www.oracle.com/technetwork/articles/java/jms20-1947669.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TOMEE-2229) JMSContext Injected by TomEE does not participate in JTA, or at least sends messages immediately
[ https://issues.apache.org/jira/browse/TOMEE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598916#comment-16598916 ] Jonathan S Fisher commented on TOMEE-2229: -- [~jgallimore] Here you go: [https://github.com/exabrial/tomee-jms2-bug/] Download and run: mvn clean package tomee:run Then: curl [http://localhost:8080/tomee-jms2-bug/api/1.0] You'll see the ack message printed instantly to the console, then 5 seconds later the transaction is cancelled after the message is already processed. ControllerEJB is marked as TransactionAttribute(Required), and XACancellingException is marked as @ApplicationException(rollback = true), so the message shouldn't be delivered. > JMSContext Injected by TomEE does not participate in JTA, or at least sends > messages immediately > > > Key: TOMEE-2229 > URL: https://issues.apache.org/jira/browse/TOMEE-2229 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.5 >Reporter: Jonathan S Fisher >Priority: Critical > > Hey guys, > We noticed that if you have a JMSContext in a transaction EJB or CDI Bean, it > always sends messages immediately instead of waiting for the XA to commit. > We found this by injecting a JMSContext into an MDB marked with > TransactionAttribute(Required), calling the jmsContext.createProducer() > method, sending some messages, then sleeping the original MDB thread for > several seconds. The messages arrive at their destinations immediately, long > before the MDB thread wakes up and the XA transaction completes. > Is there a chance our understanding is not correct? > According to the docs: > {quote}If the injected JMSContext is used in a JTA transaction (whether > container-managed or bean-managed), the JMSContext is considered to have > transaction scope. This means that after the JTA transaction is committed, > the JMSContext will be automatically closed.{quote} > References: > * https://www.oracle.com/technetwork/articles/java/jms20-1947669.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TOMEE-2229) JMSContext Injected by TomEE does not participate in JTA, or at least sends messages immediately
[ https://issues.apache.org/jira/browse/TOMEE-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16598251#comment-16598251 ] Jonathan S Fisher commented on TOMEE-2229: -- {quote}You can ensure you use RA flavor of the connecrion factory{quote} Is there a specific property that needs to be set? The relevant parts of the tomee.xml are: {code} ResourceAdapter=ra/activemq BrokerXmlConfig = ServerUrl=tcp://activemq.hostname:61616 ResourceAdapter=ra/activemq {code} > JMSContext Injected by TomEE does not participate in JTA, or at least sends > messages immediately > > > Key: TOMEE-2229 > URL: https://issues.apache.org/jira/browse/TOMEE-2229 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.5 >Reporter: Jonathan S Fisher >Priority: Critical > > Hey guys, > We noticed that if you have a JMSContext in a transaction EJB or CDI Bean, it > always sends messages immediately instead of waiting for the XA to commit. > We found this by injecting a JMSContext into an MDB marked with > TransactionAttribute(Required), calling the jmsContext.createProducer() > method, sending some messages, then sleeping the original MDB thread for > several seconds. The messages arrive at their destinations immediately, long > before the MDB thread wakes up and the XA transaction completes. > Is there a chance our understanding is not correct? > According to the docs: > {quote}If the injected JMSContext is used in a JTA transaction (whether > container-managed or bean-managed), the JMSContext is considered to have > transaction scope. This means that after the JTA transaction is committed, > the JMSContext will be automatically closed.{quote} > References: > * https://www.oracle.com/technetwork/articles/java/jms20-1947669.html -- This message was sent by Atlassian JIRA (v7.6.3#76005)