Reputation: 9281
I have tried JMS in my sample project. When using a single queue it works well, e.g.:
<messagingEngine>
<queue id="HelloQueue"/>
</messagingEngine>
<jmsQueue id="jms/HelloQueue" jndiName="java:app/jms/HelloQueue">
<properties.wasJms queueName="HelloQueue"/>
</jmsQueue>
<jmsActivationSpec id="jakartaee8-starter/HelloConsumer">
<properties.wasJms
destinationRef="jms/HelloQueue"
destinationType="javax.jms.Queue"
/>
</jmsActivationSpec>
However, when I tried to add a series of queues it does not work, e.g.
<messagingEngine>
<queue id="MisdirectedCargoQueue"/>
<queue id="CargoHandledQueue"/>
<queue id="RejectedRegistrationAttemptsQueue"/>
<queue id="HandlingEventRegistrationAttemptQueue"/>
<queue id="DeliveredCargoQueue"/>
</messagingEngine>
<jmsQueue id="jms/MisdirectedCargoQueue" jndiName="java:app/jms/MisdirectedCargoQueue">
<properties.wasJms queueName="MisdirectedCargoQueue"/>
</jmsQueue>
<jmsQueue id="jms/CargoHandledQueue" jndiName="java:app/jms/CargoHandledQueue">
<properties.wasJms queueName="CargoHandledQueue"/>
</jmsQueue>
<jmsQueue id="jms/RejectedRegistrationAttemptsQueue" jndiName="java:app/jms/RejectedRegistrationAttemptsQueue">
<properties.wasJms queueName="RejectedRegistrationAttemptsQueue"/>
</jmsQueue>
<jmsQueue id="jms/HandlingEventRegistrationAttemptQueue" jndiName="java:app/jms/HandlingEventRegistrationAttemptQueue">
<properties.wasJms queueName="HandlingEventRegistrationAttemptQueue"/>
</jmsQueue>
<jmsQueue id="jms/DeliveredCargoQueue" jndiName="java:app/jms/DeliveredCargoQueue">
<properties.wasJms queueName="DeliveredCargoQueue"/>
</jmsQueue>
<jmsActivationSpec id="cargo-tracker/MisdirectedCargoConsumer">
<properties.wasJms
destinationRef="jms/MisdirectedCargoQueue"
destinationType="javax.jms.Queue"
/>
</jmsActivationSpec>
<jmsActivationSpec id="cargo-tracker/CargoHandledConsumer">
<properties.wasJms
destinationRef="jms/CargoHandledQueue"
destinationType="javax.jms.Queue"
/>
</jmsActivationSpec>
<jmsActivationSpec id="cargo-tracker/RejectedRegistrationAttemptsConsumer">
<properties.wasJms
destinationRef="jms/RejectedRegistrationAttemptsQueue"
destinationType="javax.jms.Queue"
/>
</jmsActivationSpec>
<jmsActivationSpec id="cargo-tracker/HandlingEventRegistrationAttemptConsumer">
<properties.wasJms
destinationRef="jms/HandlingEventRegistrationAttemptQueue"
destinationType="javax.jms.Queue"
/>
</jmsActivationSpec>
<jmsActivationSpec id="cargo-tracker/DeliveredCargoConsumer">
<properties.wasJms
destinationRef="jms/DeliveredCargoQueue"
destinationType="javax.jms.Queue"
/>
</jmsActivationSpec>
When running the application I get:
[INFO] [WARNING ] CNTR4016W: The message endpoint for the CargoHandledConsumer message-driven bean cannot be activated because the java:app/jms/CargoHandledQueue destination is not available. The message endpoint will not receive messages until the destination becomes available.
[INFO] [WARNING ] CNTR4016W: The message endpoint for the RejectedRegistrationAttemptsConsumer message-driven bean cannot be activated because the java:app/jms/RejectedRegistrationAttemptsQueue destination is not available. The message endpoint will not receive messages until the destination becomes available.
[INFO] [WARNING ] CNTR4016W: The message endpoint for the MisdirectedCargoConsumer message-driven bean cannot be activated because the java:app/jms/MisdirectedCargoQueue destination is not available. The message endpoint will not receive messages until the destination becomes available.
[INFO] [WARNING ] CNTR4016W: The message endpoint for the HandlingEventRegistrationAttemptConsumer message-driven bean cannot be activated because the java:app/jms/HandlingEventRegistrationAttemptQueue destination is not available. The message endpoint will not receive messages until the destination becomes available.
[INFO] [WARNING ] CNTR4016W: The message endpoint for the DeliveredCargoConsumer message-driven bean cannot be activated because the java:app/jms/DeliveredCargoQueue destination is not available. The message endpoint will not receive messages until the destination becomes available.
Upvotes: 1
Views: 601
Reputation: 66
its the id in jmsQueue that's confusing matters, a better initial example would be
<messagingEngine>
<queue id="HelloQueue"/>
</messagingEngine>
<jmsQueue jndiName="jms/HelloQueue">
<properties.wasJms queueName="HelloQueue"/>
</jmsQueue>
<jmsActivationSpec id="jakartaee8-starter/HelloConsumer">
<properties.wasJms
destinationRef="jms/HelloQueue"
/>
</jmsActivationSpec>
There are some more examples here: https://www.ibm.com/docs/en/was-liberty/base?topic=server-configuring-point-point-messaging-single-liberty
Upvotes: 4