Im running spring in websphere and connecting to MQ queues where I'm trying to stop consuming messages from a the queue between certain times. In order for me to do this I'm shutting down the queue listener and then starting it up, here is a snippet of my code.
The problem is when it starts back up I won't receive any message unless I explicit create a new connection. like soCode://defaultListenerContainer is an instance of org.springframework.jms.listener.DefaultMessageListenerContainer; defaultListenerContainer.shutdown(); new Timer().schedule(new TimerTask() { public void run() { defaultListenerContainer.initialize(); defaultListenerContainer.start(); }}, delay); }
With the connection created I can consume messages but, when I monitor the connection pool in websphere, I notice this connection is not returned back to the pool, causing a leak.Code:defaultListenerContainer.getConnectionFactory().createConnection().start();
Anyone have any ideas on what I can do?
P.S.. Websphere will not allow me to call stop on the listener. i.e
websphere says stop is not allowed. Further research I found on the IBM website saying I can't call this command in a j2ee container.Code:defaultListenerContainer.stop()



Reply With Quote
thanks