Out of Memory due to multiple consumers ActiveMQ

38 views Asked by At

I am using DefaultMessageListenerContainer as below :

private static final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MessageConsumer.class); 
    public static final DefaultMessageListenerContainer container = context.getBean(DefaultMessageListenerContainer.class);

For a given queue that my listener listens to , the first time my program runs it starts the listener .... and this creates a Consumer for the queue that I can see in the Active MQ Console.

The problem I have is every time I checkin some new code, there is another new Consumer created for the queue and the old one is still hanging on creating some Out of Memory issue.

What am I doing wrong here? How do I make sure there is only 1 consumer and the old consumer is killed with every new code checkin? Hope I explained the issue clearly.

0

There are 0 answers