smallrye-reactive-messaging
smallrye-reactive-messaging copied to clipboard
Using JMS connector in WildFly with its embedded ActiveMQ server
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 [email protected]//org.apache.activemq.artemis.ra.ActiveMQRASession.getSession(ActiveMQRASession.java:1158)
at [email protected]//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?