Results 1 to 7 of 7

Thread: Using jms:message-driven-channel-adapter without poller?

  1. #1

    Default Using jms:message-driven-channel-adapter without poller?

    In the Spring Integration in Action Book MEAP on page 190-191 it suggeststhat you don't need a poller for a jms:message-driven-channel-adapter. However, if I comment out my poller it blows up saying I need a poller. Does this require a different configuration on the DMLC to hook up to my topic? I've added the exception at the bottom.

    Thanks,
    -Dave

    Code:
    <int:poller id="defaultPoller" default="true" max-messages-per-poll="1" fixed rate="10">
      <int:transactional/>
    </int:poller>

    Code:
    <bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="concurrentConsumers" value="1"/>
        <property name="connectionFactory" ref="oceaneventConnectionFactory"/>
        <property name="destinationName" value="jms.oceanevent.inbound"/>
        <property name="destinationResolver" ref="destResolver"/>
        <property name="sessionTransacted" value="true"/>
        <property name="pubSubDomain" value="true"/>
        <property name="subscriptionDurable" value="true"/>
        <property name="durableSubscriptionName" value="jms.durablesub.oceanevent"/>
      </bean>

    Code:
    <int-jms:message-driven-channel-adapter id="inboundJms"
    	                                             channel="inboundMessageChannel" 
    			                             container="defaultMessageListenerContainer"/>
    Code:
    Caused by: java.lang.IllegalArgumentException: No poller has been defined for endpoint 'org.springframework.integration.config.ConsumerEndpointFactoryBean#2', and no default poller is available within the context.
            at org.springframework.util.Assert.notNull(Assert.java:112)
            at org.springframework.integration.config.ConsumerEndpointFactoryBean.initializeEndpoint(ConsumerEndpointFactoryBean.java:158)
            at org.springframework.integration.config.ConsumerEndpointFactoryBean.afterPropertiesSet(ConsumerEndpointFactoryBean.java:113)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
            at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:465)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(Unknown Source)
            at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)
            at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1784)
            at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)
            at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Dave, is that your full config or are there other endpoints defined? The reason I ask is that the message-driven-channel-adapter should indeed *not* require a poller. Also, since that adapter does have an id, I would expect to see that ("inboundJms") in any error message associated with it whereas the error message you posted looks like it's referring to some anonymous endpoint (from an element that has no id attribute).

    -Mark

  3. #3

    Default

    Mark, there is the full SI config.

    Code:
    <int-jms:message-driven-channel-adapter id="inboundJms"
    	                                                channel="inboundMessageChannel" 
    			                                 container="defaultMessageListenerContainer"/>
    			 
    	
    	<int:channel id="inboundMessageChannel">
    		<int:queue capacity="500"/>
    	</int:channel>
    	
    	
    	<int:service-activator input-channel="inboundMessageChannel"
    	                                                   output-channel="transformChannel"
    	                                                   ref="oceanEventService"
    	                                                   method="saveHistory"/>
    	
    	
    	<int:channel id="transformChannel">
    		<int:queue/>
    	</int:channel>
    
    	 
    	<int:chain input-channel="transformChannel" output-channel="eventChannel">
    		<int-xml:xslt-transformer id="inboundTransform"
    				                  xsl-resource="classpath:eem_msn.xsl"
    			                          result-type="StringResult"/>
    		<int-xml:unmarshalling-transformer unmarshaller="marshaller"/>
    		<int:splitter expression="payload.list"/>
    	</int:chain>
    	
    	
    	<int:channel id="eventChannel">
    		<int:queue/>
    	</int:channel> 
    	
    	
    	<int:chain input-channel="eventChannel" output-channel="outboundEventChannel">
    		<int:filter expression="payload.containerId > 0" />
    		<int:service-activator ref="oceanEventService" method="persist"/>
    	</int:chain>
    	
    	
    	<int:channel id="outboundEventChannel">
    		<int:queue/>
    	</int:channel>
    
    
     	<int-jdbc:outbound-channel-adapter
    			data-source="dataSource"
    			channel="outboundEventChannel">
    			<int-jdbc:query>
    					update mns_ocean_event_history_mt
    					set is_successful = 'Y'
    					where ocean_event_history_id = :headers[historyId]
    			</int-jdbc:query>
    	</int-jdbc:outbound-channel-adapter>
    	
    	
    	<int-stream:stderr-channel-adapter channel="errorChannel" append-newline="true"/>
    	
    
    	<oxm:jaxb2-marshaller id="marshaller">
    		<oxm:class-to-be-bound name="com.matson.oceanevent.domain.OceanEvents"/>
    	 	<oxm:class-to-be-bound name="com.matson.oceanevent.domain.OceanEvent"/>
    	 	<oxm:class-to-be-bound name="com.matson.oceanevent.domain.OceanEventBillOfLading"/>
    	 	<oxm:class-to-be-bound name="com.matson.oceanevent.domain.OceanEventCommodity"/>
    	 	<oxm:class-to-be-bound name="com.matson.oceanevent.domain.OceanEventParty"/>
    	</oxm:jaxb2-marshaller>
    
    <int:service-activator input-channel="errorChannel" 
    			                           output-channel="emailChannel" 
    	                                           ref="errorHandler" 
    	                                           method="onError"/>
    
    
    	<int:channel id="emailChannel"/>	                       
    
    
    	<int-mail:outbound-channel-adapter channel="emailChannel" mail-sender="mailSender"/>

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Okay, so the error is a result of the other components there. Anytime you have an 'input-channel' that refers to a <channel> that itself contains a <queue>. If you add "id" attributes to the <service-activator>, <chain>, etc., you should see the actual name of the component that requires a poller.

    As a side question, do you really want to have buffering via queues within each channel? It will cause any transactional context to be broken (since such context is associated with the Thread).

  5. #5

    Default

    Thank you Mark. Yes, once I added ID's to each endpoint I saw that each one connected to a <queue> channel caused an issue.

    I had been experimenting with transactional boundaries which is why you saw all the queues. Here is my original config (with ID's added) that throws the same exception without a poller. (It's the same exact config but with direct channels and a task-executor instead of a queue after the split).

    Code:
    <int-jms:message-driven-channel-adapter id="inboundJms"
    	                                        channel="inboundMessageChannel" 
    			                                    container="defaultMessageListenerContainer"/>
    			 
    	
    	<int:channel id="inboundMessageChannel"/>
    	
    	
    	<int:service-activator input-channel="inboundMessageChannel" id="historyActivator"
    	                       output-channel="transformChannel"
    	                       ref="oceanEventService"
    	                       method="saveHistory"/>
    	
    	
    	<int:channel id="transformChannel"/>
    	 
    
    	<int:chain input-channel="transformChannel" output-channel="eventChannel" id="splitChain">
    		<int-xml:xslt-transformer id="inboundTransform"
    				                      xsl-resource="classpath:eem_msn.xsl"
    			                        result-type="StringResult"/>
    		<int-xml:unmarshalling-transformer unmarshaller="marshaller"/>
    		<int:splitter expression="payload.list"/>
    	</int:chain>
    	
    	
    	<int:channel id="eventChannel">
    		<int:dispatcher task-executor="executor"/>
    	</int:channel> 
    	
    	
    	<int:chain input-channel="eventChannel" output-channel="outboundEventChannel" id="persistChain">
    		<int:filter expression="payload.containerId > 0" />
    		<int:service-activator ref="oceanEventService" method="persist"/>
    	</int:chain>
    	
    	
    	<int:channel id="outboundEventChannel"/>
    
    	
     <int-jdbc:outbound-channel-adapter
    			data-source="dataSource"
    			channel="outboundEventChannel">
    			<int-jdbc:query>
    					update mns_ocean_event_history_mt
    					set is_successful = 'Y'
    					where ocean_event_history_id = :headers[historyId]
    			</int-jdbc:query>
    	</int-jdbc:outbound-channel-adapter>
    	
    	
    	<int-stream:stderr-channel-adapter channel="errorChannel" append-newline="true" id="errorout"/>
    
    <int:service-activator input-channel="errorChannel" 
    			                   output-channel="emailChannel" 
    	                       ref="errorHandler" 
    	                       method="onError"
    	                       id="mailActivator"/>
    
    
    	<int:channel id="emailChannel"/>	 
    	
    	<task:executor id="executor"/>                      
    
    	<int-mail:outbound-channel-adapter channel="emailChannel" mail-sender="mailSender" id="mailAdapter"/>

    Code:
    Caused by: java.lang.IllegalArgumentException: No poller has been defined for endpoint 'org.springframework.integration.config.ConsumerEndpointFactoryBean#1', and no default poller is available within the context.
            at org.springframework.util.Assert.notNull(Assert.java:112)
            at org.springframework.integration.config.ConsumerEndpointFactoryBean.initializeEndpoint(ConsumerEndpointFactoryBean.java:158)
            at org.springframework.integration.config.ConsumerEndpointFactoryBean.afterPropertiesSet(ConsumerEndpointFactoryBean.java:113)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
            at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:465)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(Unknown Source)
            at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)
            at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1784)
            at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)
            at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)
    Thanks,
    -Dave

  6. #6

    Default

    I've found the issue. Thank you Mark. Had one additional queue in another SI config that I missed. Works like a charm now.

    Thanks again,
    DT

  7. #7
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Great. That was going to be my next question... "any other configs"?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •