Hi All,
i am using MessageListnerContainer and jmstemplate together in a flow of application
we have a seprate component to update records from our main app. for this we drop message on a local queue and a listner is listning on that queue.
and below is configuration for same listner class in container.Code:public class NotifyMessageListenerImpl implements MessageListener { private String LOGGING_CLASS = "NotifyMessageListenerImpl"; private NotifyLimitBOImpl notifyLimitBOImpl; private ProfileLogger profileLogger; public void setNotifyLimitBOImpl(NotifyLimitBOImpl notifyLimitBOImpl) { this.notifyLimitBOImpl = notifyLimitBOImpl; } public void setProfileLogger(ProfileLogger profileLogger) { this.profileLogger = profileLogger; } public void onMessage(Message message) { final String LOGGING_METHOD = "onMessage"; String sessionId=""; profileLogger.writeToTraceLog(sessionId, GlobalLimitsConstants.ENTRY, Level.DEBUG, LOGGING_CLASS, LOGGING_METHOD, null); if (message instanceof ObjectMessage) { try { // Get object from the message and pass it to NotifyLimitBOImpl for processing CASRequestVO casRequestVO = (CASRequestVO) ((ObjectMessage) message).getObject(); sessionId=casRequestVO.getSessionId(); this.notifyLimitBOImpl.notifyGlobalLimits(casRequestVO); } catch (JMSException ex) { } } else { throw new IllegalArgumentException("Message must be of type ObjectMessage"); } profileLogger.writeToTraceLog(sessionId, GlobalLimitsConstants.EXIT, Level.DEBUG, LOGGING_CLASS, LOGGING_METHOD, null); }
once a message is received by listner is starts a processing thread as in above listner codeCode:<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="jmsConnectionFactory" /> <property name="destination" ref="jmsCasNtfQueue" /> <property name="messageListener" ref="notificationListner" /> <property name="taskExecutor" ref="myTaskExecutor" /> <property name="transactionManager" ref="transactionManager" /> <property name="transactionTimeout"> <value>25</value> </property> </bean>
this.notifyLimitBOImpl.notifyGlobalLimits(casReque stVO);
after some processing we send a text message and receive responce message back synchronously using jmstemplate
as
Code:messageSender.sendMessage(updateGlobalLimitsRequestString, sessionId, this.jmsQueue, this.jmsReplyQueue); messageReceiver.receiveMessage(correlationStringBuffer.toString(), sessionId,this.jmsReplyQueue);
but here send and receive is not happening rightly
message sent doesnt reaches broker as long as receive doesnt timeout .at same time as receive timeouts message is delivered to broker and it goes further and a response is retruned on reply queue but receive is already timed out.
PLEASE provide light on these
>can it be because of listner container and jmstemplate being used conjugation and on same thread(flow of calls)
>can it be because of underlaying session or connection being held by container or jmstemplate and when receive timeouts message goes out to external system(to clarify its a real queue external to our app) .
>any other possible reason u can think of.
to make it more precisewe are using websphere v6.1 as server and websphere MQ as message brokerproblem is, sent message doesnt reach MQ broker until receive timesout on jmstemplate when we are having messagelistner and container at begning of flow
its urgent please provide ur suggessions
thanks a lot


Reply With Quote
