Announcement Announcement Module
Collapse
No announcement yet.
Default Message driven Channel Adapter is taking too long to receive messages. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Default Message driven Channel Adapter is taking too long to receive messages.

    Code:
       	<bean id="oms.topicDurableProps" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
            <property name="singleton" value="true"/>
            <property name="properties">
                <props>
                    <prop key="cmeDurableName">${skore.jms.omsdurablename-cme}</prop>
                    <prop key="cmeDurableClientId">skore_${skore.environment.name}_oms_cme</prop>
                    <prop key="cmeMessageSelector">${skore.jms.omsmessageselector-cme}</prop>
                    <prop key="iceDurableName">${skore.jms.omsdurablename-ice}</prop>
                    <prop key="iceDurableClientId">skore_${skore.environment.name}_oms_ice</prop>
                    <prop key="iceMessageSelector">${skore.jms.omsmessageselector-ice}</prop>
                    <prop key="cfeDurableName">${skore.jms.omsdurablename-cfe}</prop>
                    <prop key="cfeDurableClientId">skore_${skore.environment.name}_oms_cfe</prop>
                    <prop key="cfeMessageSelector">${skore.jms.omsmessageselector-cfe}</prop>
                </props>
            </property>
        </bean>
    
        <bean id="oms.requestTopicContainer" parent="common.cachedTopicListenerContainer" 
                  class="com.ubs.etdet.skore.grid.messagecontainer.RequestTopicContainer" init-method="refresh">
            <property name="destination" ref="common.requestTopic"/>
            <property name="exchangeName" ref="common.instanceName"/>
            <property name="topicDurableProps" ref="oms.topicDurableProps"/>
        </bean>
    
        <!-- Read messages off this JMS channel, convert to MasterTransferObjects, drop onto pre-validation channel -->
        <jms:message-driven-channel-adapter id="oms.requestChannelAdapter"
                                            container="oms.requestTopicContainer"
                                            message-converter="oms.skoreMtoConverterToSke"
                                            channel="oms.request"/>

    RequestTopicContainer.java

    Code:
    package com.ubs.etdet.skore.grid.messagecontainer;
    
    import java.util.Properties;
    
    import javax.jms.JMSException;
    import javax.jms.Session;
    
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.jms.listener.DefaultMessageListenerContainer;
    
    public class RequestTopicContainer extends DefaultMessageListenerContainer {
    
        Logger logger = LoggerFactory.getLogger(RequestTopicContainer.class);
        public String exchangeName;
        public Properties topicDurableProps;
    
        public RequestTopicContainer() {
            super();
        }
    
        public Properties getTopicDurableProps() {
            return topicDurableProps;
        }
    
        public void setTopicDurableProps(Properties topicDurableProps) {
            this.topicDurableProps = topicDurableProps;
        }
    
        public String getExchangeName() {
            return exchangeName;
        }
    
        public void setExchangeName(String exchangeName) {
    
            this.exchangeName = exchangeName;
        }
    
        @Override
    	protected void messageReceived(Object invoker, Session session) {
        	try {
    			logger.info("Message is received.."+session.getTransacted());
    			
    		} catch (JMSException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	}
    
        public void refresh() throws JMSException {
    
            final String clientId = getTopicDurableProps().getProperty(getExchangeName() + "DurableClientId");
            final String durableName = topicDurableProps.getProperty(getExchangeName() + "DurableName");
            final String msgSelector = getTopicDurableProps().getProperty(getExchangeName() + "MessageSelector");
    
            logger.debug("Calling refresh with clientId: {}, durableName: {}, msgSelector: {}",
                    new Object[]{clientId, durableName, msgSelector});
    
            super.setDurableSubscriptionName(durableName);
            super.setClientId(clientId);
            super.setMessageSelector(msgSelector);
        	super.setReceiveTimeout(-1);
        	super.setIdleTaskExecutionLimit(1000);
            refreshSharedConnection();
        }
    
    }

    Code:
        <bean id="common.cachedTopicListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"
                abstract="true">
            <property name="connectionFactory" ref="common.topiccachedConnectionFactory"/>
            <property name="sessionTransacted" value="false" />
    
        </bean>
    
        	<bean id="common.topiccachedConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory" lazy-init="true"> 
              <property name="targetConnectionFactory" ref="common.omstopicConnectionFactory"/> 
              <property name="sessionCacheSize" value="10" />
              <property name="reconnectOnException" value="true" />
        </bean>
    
    		<bean id="common.omstopicConnectionFactory" parent="common.clientIdUserCredentialsConnectionFactoryAdapter" lazy-init="true">
    		<property name="targetConnectionFactory">
    			<bean class="com.tibco.tibjms.TibjmsTopicConnectionFactory">
    				<constructor-arg index="0"
    					value="${ems.topic.conn.factory.url}" />
    			</bean>
    		</property>
    	</bean>
    Each time a message is put into this channel by another component, message-driven-channel-adapter is taking 12 or more milliseconds to retrieve the message. Please suggest.
    Last edited by srikanthradix; Feb 28th, 2011, 06:19 PM. Reason: correction.

  • #2
    Log from the server.

    After sending the message referred to by "toMessage", there is a lag in retrieval of message from the durable topic. The log is mentioned below:


    Code:
    
    
    2011-02-28 16:40:00,607 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    2011-02-28 16:40:00,609 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,610 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,614 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    
    2011-02-28 16:40:00,624 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    2011-02-28 16:40:00,628 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,629 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,634 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    2011-02-28 16:40:00,636 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    
    
    
    2011-02-28 16:40:00,631 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    
    2011-02-28 16:40:00,648 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,649 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,654 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    2011-02-28 16:40:00,666 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    
    
    2011-02-28 16:40:00,637 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    2011-02-28 16:40:00,683 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,683 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,688 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage
    2011-02-28 16:40:00,690 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    
    
    
    2011-02-28 16:40:00,645 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    2011-02-28 16:40:00,702 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,703 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,708 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    2011-02-28 16:40:00,710 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    
    2011-02-28 16:40:00,651 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    2011-02-28 16:40:00,722 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,723 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,727 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    2011-02-28 16:40:00,729 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    
    
    2011-02-28 16:40:00,657 INFO  [pool-1-thread-1] jms.MessageLogger - legacy-backend-inbound:toMessage 
    
    
    2011-02-28 16:40:00,743 INFO  [oms.requestTopicContainer-1] messagecontainer.RequestTopicContainer - Message is received..false
    2011-02-28 16:40:00,743 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:fromMessage 
    2011-02-28 16:40:00,748 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage 
    2011-02-28 16:40:00,750 INFO  [pool-3-thread-1] jms.MessageLogger - oms-cme:toMessage

    Comment


    • #3
      Somebody plz help with this issue.

      It is very helpful if somebody can give me some pointers in resolving this issue.

      I have overridden the receiveMessage(MessageConsumer consumer) {
      and consumer.receive()
      }
      instead of polling the queue every now and then. It didn't help either.

      Comment


      • #4
        Please help

        Please help with this issue. Am I doing anything wrong from the code stand-point?

        Comment


        • #5
          One thing I notice from your log output is that even though you are using a thread pool, it is always the same thread handling the message. Can you show the configuration of the thread pool?

          Comment


          • #6
            We are not using any Thread-pool executors.

            Mark,

            We are not using any Thread-pool executors in our logic. Our component is supposed to be single-threaded.

            There is one topic.
            There are three durables for this topic.
            Based upon the message selector, the topic decides which durable the message should go to and that is being picked up by the message-driven-channel-adapter. Other than that, there is nothing we have done. No threading. There is logging which is asynchronous.

            Apart from the code, that I have posted there is no configuration before message-driven-channel-adapter puts the message into a channel.

            <springframework.version>2.5.6</springframework.version>
            <springintegration.version>1.0.3.RELEASE</springintegration.version>

            Regards,
            Sri.

            Comment

            Working...
            X