Announcement Announcement Module
Collapse
No announcement yet.
how can define my taskScheduler for each poller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how can define my taskScheduler for each poller

    Because the "taskScheduler" bean (a global taskScheduler) is responsible for managing all pollers,so i cannot define my taskSchedulers to some pollers.

    i want to define custom myTaskScheduler for each poller,such as

    myTaskSchedulerA for pollerA,
    myTaskSchedulerB for pollerB,
    myTaskSchedulerC for pollerC...

    Does anyone have any ideals ?

    Thanks !

  • #2
    Well how about reading the reference guide, it is explained there...
    Last edited by Marten Deinum; Mar 22nd, 2010, 06:44 AM.

    Comment


    • #3
      Well, the previous reply was a bit blunt, but I hope you did find the reference manual link helpful. Basically, you just want to add a "task-executor" attribute to the poller and provide a reference to a TaskExecutor.

      If you are using Spring 3.0, you might also want to consider the new "task" namespace. With that, configuration of TaskExecutors is very simple:
      http://static.springsource.org/sprin...task-namespace

      Hope that helps.
      -Mark

      Comment


      • #4
        Hmm Mark I guess you are right, maybe the time has come to look on, 99% of the questions I answer are answered before (sometimes in the same week) or are solved by reading the reference guide.

        I'll ponder on that for a while.

        And sorry for the blunt reply/replies I made...

        Comment


        • #5
          I think you've probably answered most questions at least 2X
          And, your help on the forums is definitely appreciated.

          I'm just usually trying to consider the possibility that our docs might not be clear enough (in the case of the XSD, I have an open issue to provide more detail).

          Cheers,
          Mark

          Comment


          • #6
            Originally posted by Mark Fisher View Post
            Well, the previous reply was a bit blunt, but I hope you did find the reference manual link helpful. Basically, you just want to add a "task-executor" attribute to the poller and provide a reference to a TaskExecutor.

            If you are using Spring 3.0, you might also want to consider the new "task" namespace. With that, configuration of TaskExecutors is very simple:
            http://static.springsource.org/sprin...task-namespace

            Hope that helps.
            -Mark
            Hi,Mark.
            I konw that the poller's "task-executor" attribute can reference a TaskExecutor,but the all TaskExecutors use a global taskScheduler.
            So I want to know how to config a TaskExecutor with a custom taskScheduler,not a global one.

            such as :

            <task:executor id="executor1" pool-size="6" queue-capacity="10" keep-alive="1"/>

            <task:executor id="executor2" pool-size="3" queue-capacity="1" keep-alive="1"/>

            <task:scheduler id="taskScheduler" pool-size="6" />

            .....
            <poller id="poller1" task-executor="executor1" receive-timeout="2">
            <interval-trigger interval="100"/>
            </poller>
            ......

            ......
            <poller id="poller2" task-executor="executor2" receive-timeout="20">
            <interval-trigger interval="1000"/>
            </poller>


            The "taskScheduler" is the global taskScheduler.
            The poller1 refences "executor1" and the poller2 refences "executor2".
            The "executor1" and "executor2" use a default taskScheduler (a global one).
            So i want define custom taskSchedulers (not a global one) for each "executor1" and "executor2" .

            such as :
            taskScheduler1 for "executor1"
            taskScheduler2 for "executor2"

            and the taskScheduler1 and taskScheduler2 are not the global taskScheduler which id is "taskScheduler".

            But i find the SI does not support it ,So how can i define a custom taskScheduler for each task-executor?

            Anybody has a good idea about this?

            Thanks very much!

            Comment


            • #7
              You don't need to, if you would the poolsize would be pretty much useless on the task-executor.

              From the docs

              When Polling Consumers provide an explicit task-executor reference in their configuration, the invocation of the handler methods will happen within that executor's thread pool and not the main scheduler pool. However, when no task-executor is provided for an endpoint's poller, it will be invoked by one of the main scheduler's threads.
              And please use [ code][/code ] tags when posting code.

              Comment

              Working...
              X