Announcement Announcement Module
Collapse
No announcement yet.
load-balancer on direct channel Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • load-balancer on direct channel

    Are there any samples on load-balancer usage?

    Thanks

  • #2
    No, but all you need is configure two subscribers to the channel and send more then one message. If LB is 'round-robin', then you'll see that each subscriber gets every other message. If LB is 'failover', then you can simply raise a runtime exception in one subscriber and it will failover to another.

    Comment


    • #3
      well actually i dont want to manually define my subscribers. My intent is to launch separate thread for each message to be processed further.

      I'm trying to achieve is, as soon as the splitter sends each message out, a new thread should be launched for the same handler so essentially multi-threaded message handling?

      Can we do it?

      Thanks

      Comment


      • #4
        If I understand what you're trying to do, I think you might want to just look at the <channel/> with a <dispatcher executor="anyTaskExecutor"/> sub-element.

        Comment


        • #5
          seems like it would solve. Thanks

          Comment


          • #6
            so looking back on load-balancer does it really add value to have it if it is a direct channel with only one subscriber.
            would it make sense to disallow? i have tried and it does not harm to have it in there but its also not going to do anything if there is one subscriber.

            Thanks

            Comment


            • #7
              Load balancing implies some type of distribution, which essentially means more then a single component. Of course having 'load-balancer' with a single subscriber won't do anything and why should it? There might not be a subscriber now, but it could certainly be added at runtime.
              In any event, just want to make sure I understand correctly. in your case it was never about load balancing, you just simply wanted "to launch separate thread for each message"... right?

              Comment


              • #8
                correct. i kinda of got misled with load-balancer tag, i assumed it would launch the subscriber in a multi-threaded fashion.

                Registering a subscriber at run time seems like a new idea to me, i didn't think of it. I thought when the framework initializes the integration and sees there is only one subscriber to this channel, maybe it could give some kind of warning to say load-balancer is not used.

                maybe i mis-interpreted the documentation.

                Thanks

                Comment


                • #9
                  Look at it this way. 'load-balancer' attribute specifies what strategy to use if there is more then one subscriber (essentially telling message dispatcher how to distribute messages), but the only time you need to define it explicitly if you decide to override what the default one is which is round-robin. So weather you have it there or not MessageDispatcher has a default strategy on how to dispatch the messages, so there is no reason to issue any type of warning.

                  Comment


                  • #10
                    Agreed . Thanks for quick response

                    Comment

                    Working...
                    X