I have a Spring App working with JMS (ActiveMQ)
I have the following:
@Bean
public DefaultJmsListenerContainerFactory jmsListenerQueueContainerFactoryForSection01(ConnectionFactory selectedConnectionFactory) {
DefaultJmsListenerContainerFactory djlcf = new DefaultJmsListenerContainerFactory();
djlcf.setClientId("jmsListenerQueueContainerFactoryForSection01");
djlcf.setConnectionFactory(selectedConnectionFactory);
djlcf.setPubSubDomain(false);
djlcf.setConcurrency("1");
djlcf.setAutoStartup(true);
djlcf.setSubscriptionDurable(false);
return djlcf;
}
And about @JmsListener
I have:
@JmsListener(destination="springintegration.queue.local.to.section01",
containerFactory="jmsListenerQueueContainerFactoryForSection01")
public void receiveToSection01(Message message){
logger.info("receiveToSection01: {}", message.toString());
}
I can confirm in ActiveMQ
web console that exists in Active Subscribers the jmsListenerQueueContainerFactoryForSection01
Until here I am fine.
Now if I use the @JmsListener
's id attribute such as:
@JmsListener(destination="springintegration.queue.local.to.section01",
id="abc",
containerFactory="jmsListenerQueueContainerFactoryForSection01")
public void receiveToSection01(Message message){
logger.info("receiveToSection01: {}", message.toString());
}
I never can see the id
abc in the ActiveMQ
web console.
I always see jmsListenerQueueContainerFactoryForSection01
- I know that
@JmsListener
concurrency attribute can override theDefaultJmsListenerContainerFactory
setConcurrency method
But it does not apply to the id
attribute.
According with the @JmsListener'id api says
The unique identifier of the container managing this endpoint. If none is specified, an auto-generated one is provided.
Therefore
- When is useful use the
@JmsListener
id attribute? - Where I can see the
@JmsListener
id (abc
in this case - or even the auto-generated according with the API)