Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Poller and max-messages-per-poll

  1. #1
    Join Date
    Oct 2007
    Posts
    142

    Default Poller and max-messages-per-poll

    I need some more explanation on the use of poller.
    I have understood that they are use to trigger event on channel for send retrieve.

    What is the property max-messages-per-poll use for?
    What is the default value for that property?

    I have defined a default poller for my application.
    How many message can be send consume at the same time.
    Is there a way to define the number of thread that can be active is a channel ? (Maybe it’s the max-messages-per-poll property).

    Regards

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Good question and is being a source of confusion for a few people, so we've recently updated documentation to provide more details on the Polling Consumer and its properties.
    Here is the link: http://build.springsource.org/downlo...ollingconsumer
    and this:http://build.springsource.org/downlo...#async-polling

    Please respond here if it is still unclear and we'll follow up.
    Last edited by oleg.zhurakousky; Oct 5th, 2010 at 02:24 PM.

  3. #3
    Join Date
    Oct 2007
    Posts
    142

    Default Sill don't understand

    Hi

    I have to admit that I don’t understand the need of a poller.
    I may be naive but message are suppose to be send and receive by end point.


    I tried this configuration:

    <sioller default="true" max-messages-per-poll="10" task-executor="taskExecutor"/>
    <task:executor id="taskExecutor" pool-size="10" queue-capacity="0"/>

    And get the error:
    Configuration problem: A <poller> must have a one and only one trigger configuration.

  4. #4
    Join Date
    Sep 2010
    Posts
    5

    Default

    hi,

    Since you have defined a default poller, it must have a trigger, try to use a cron or an interval-trigger.

    Luis

  5. #5
    Join Date
    Oct 2007
    Posts
    142

    Exclamation Behavior

    Hi

    What is the behavior of a poller.
    When a message arrives to a channel,
    -the message is consumed one at the time.
    -a new thread is created to consume the message

    Here is my configuration

    Code:
    <si:poller default="true" max-messages-per-poll="1000">
    	<si:interval-trigger interval="100"/>
    </si:poller>
    
    <si:service-activator input-channel="inChannel" ref="myBean" method="execute" output-channel="outChannel" />
    In fact my bean is thread safe.
    I would like a thread to be created for each message for performance reason.

    Regards
    Last edited by spcmdr; Oct 7th, 2010 at 11:14 AM. Reason: update

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

    Default

    A poller is only needed if the source of Messages requires polling. In other words, when using an asynchronous MessageChannel with a "queue", its subscribers must poll. Likewise, when creating an inbound adapter for a directory on the File system, a poller is required.

    Can you provide a bit more of your configuration so we can see where the poller is being used?

    Thanks,
    Mark

  7. #7
    Join Date
    Oct 2007
    Posts
    142

    Default

    Here is the config

    Code:
    <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" p:brokerURL="vm://localhost?broker.persistent=false"/>
    
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" depends-on="connectionFactory">
    	<property name="connectionFactory" ref="connectionFactory" />
    	<property name="defaultDestinationName" value="orderQueue" />
    	<property name="receiveTimeout" value="300" />
    </bean>
    
    <si:poller default="true" max-messages-per-poll="10">
    	<si:interval-trigger interval="100"/>
    </si:poller>
    
    <sijms:channel id="jobChannel" queue-name="jobChannelQueue" error-handler="messagePublishingErrorHandler" />
    <sijms:channel id="aggregateChannel" queue-name="aggregateChannelQueue" error-handler="messagePublishingErrorHandler" />
    <sijms:channel id="deliverChannel" queue-name="deliverChannelQueue" error-handler="messagePublishingErrorHandler" />
    <sijms:channel id="errorChannel" queue-name="errorQueue" error-handler="messagePublishingErrorHandler"/>
    <si:channel id="jmsErrorChannel"><si:queue/></si:channel>
    
    <sijms:message-driven-channel-adapter destination-name="orderQueue" channel="dispatcherChannel" connection-factory="connectionFactory"/>
    
    <si:splitter input-channel="dispatcherChannel" ref="dispatcher" method="dispatch" output-channel="jobChannel"/>
    <si:service-activator input-channel="jobChannel" ref="jobManager" method="executeTask" output-channel="aggregateChannel" />
    
    <si:aggregator input-channel="aggregateChannel"  ref="aggregateManager" output-channel="deliverChannel"  send-timeout="7200000"/>
    
    <si:outbound-channel-adapter channel="deliverChannel" ref="deliverManager" method="deliver" />
    	
    <!-- error message -->
    <bean id="messagePublishingErrorHandler" class="org.springframework.integration.channel.MessagePublishingErrorHandler">
    		<property name="defaultErrorChannel" ref="jmsErrorChannel" />
    </bean>
    
    <si:service-activator input-channel="jmsErrorChannel" ref="projectTaskExceptionHandler"/>
    [orderQueue]-->dispatcherChannel-->jobChannel-->aggregateChannel-->deliverChannel
    [all exception]-->(messagePublishingErrorHandler)-->jmsErrorChannel-->(projectTaskExceptionHandler)


    Regards

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

    Default

    I don't see anything in that configuration that would require a poller. Are you receiving an error when you remove the poller element?

  9. #9
    Join Date
    Oct 2007
    Posts
    142

    Default Poller

    Hi

    I added a poller because spring wanted one.

    Code:
    Caused by: java.lang.IllegalArgumentException: No poller has been defined for endpoint 'org.springframework.integration.config.ConsumerEndpointFactoryBean#11', 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:152)
    	at org.springframework.integration.config.ConsumerEndpointFactoryBean.afterPropertiesSet(ConsumerEndpointFactoryBean.java:107)
    Regards

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

    Default

    Sorry, I didn't notice the 'queue' sub-element within "jmsErrorChannel". Why did you decide to add a queue there?

Posting Permissions

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