smallrye / smallrye-reactive-messaging

SmallRye Reactive Messaging
http://www.smallrye.io/smallrye-reactive-messaging/
Apache License 2.0
241 stars 179 forks source link

Using JMS connector in WildFly with its embedded ActiveMQ server #2347

Open jarek-przygodzki opened 1 year ago

jarek-przygodzki commented 1 year ago

Whats the recommended solution for using JMS connector from within WildFly with its embedded ActiveMQ server?

Using the connector with default ConnectionFactory does not work

@ApplicationScoped
public class JmsConnectionFactory
{
    @Resource ConnectionFactory cf;
    @Produces ConnectionFactory factory() { return cf; }
}

because message acknowledgement fails with

javax.jms.IllegalStateException: Non XA connection
    at org.apache.activemq.artemis.ra@2.19.1//org.apache.activemq.artemis.ra.ActiveMQRASession.getSession(ActiveMQRASession.java:1158)
    at org.apache.activemq.artemis.ra@2.19.1//org.apache.activemq.artemis.ra.ActiveMQRAMessage.acknowledge(ActiveMQRAMessage.java:71)
    at deployment.mp-reactive-messaging.war//io.smallrye.reactive.messaging.jms.IncomingJmsMessage.lambda$ack$0(IncomingJmsMessage.java:115)
    ... 5 more

What does work is using the remote connection factory (user/password need to be specified in channel config)

@ApplicationScoped
public class JmsConnectionFactory
{
    @Resource(mappedName = "java:jboss/exported/jms/RemoteConnectionFactory") ConnectionFactory cf;
    @Produces ConnectionFactory factory() { return cf;  }
}

However this seems like a kludge. Is there a batter way?

cescoffier commented 1 year ago

\CC @kabir

kabir commented 1 year ago

WildFly does not include the JMS connector from SmallRye Reactive Messaging at this stage. To send to/receive from JMS in WildFly you need to use standard JMS.

However, in WildFly our embedded ActiveMQ supports AMQP, so you might be able to use https://github.com/wildfly/wildfly/pull/16281 once that is merged.