Using Wildfly 10.1.0.Final and a custom JMS message queue, I can successfully send and receive messages over the in-vm InVmConnectionFactory
with the JNDI name java:/ConnectionFactory
.
However, I cannot get the new pooled-connection-factory
with JNDI name java:/JmsXA
to work, messages simply get lost and don't show up anywhere (also checked the wildfly console's runtime JMS server view (Runtime->Subsystems->Messaging - ActiveMQ
).
Because the active-mq
pooled connection factory is marked as DefaultJMSConnectionFactory
, using the JMS 2.0 API and simply injecting the JMSContext via
@Inject
JmsContext jmsContext;
message sending will not work out of the box.
This is quite strange and I have found no similar issues with a recent wildfly 10 configuration that uses the included Artemis (ActiveMQ) broker.
The connection-factory is defined as transactional by default, but this is overkill for our scenario, so I switched it off:
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA" connectors="in-vm" transaction="none"/>
I checked the Wildfly messaging configuration guide and various online examples covering JMS 1.1/2.0, but found no clue so far.
Sample code:
@Startup // just for a simple test sending a message right on startup
public class MessageService {
@Inject
@JMSConnectionFactory("java:/JmsXA") // activemq-ra pooled-connection-factory
private JMSContext jmsContext;
@Resource(lookup = JAVA_JMS_PROGRESS_QUEUE)
private Queue progressQueue;
public MessageService() {
}
@PostConstruct
private void init() {
final JMSProducer jmsProducer = jmsContext.createProducer();
jmsProducer.send(progressQueue, "Hello queue"));
}
}
turns out the method where the message is sent still needs to be declared as non-transactional, even when the connection-factory is already configured as such:
works now!