2 Replies Latest reply on Mar 20, 2008 8:38 AM by mathieu

    ScheduledEventMessageComposer to pickup more than one messag

      Hello,

      I am working with a scheduled-listener and a event-processor implementing the ScheduledEventMessageComposer interface. The processor is checking in a external system to see if there are files waiting. It processes the first one (if there is any).

      The schedule-provider triggers an event every minutes and everything works great most of the time. However, I sometimes receive a lot of file (1000+) over a short period of time. Due to the polling, they are only processed every minute.

      Is there a way to reinvoke the ScheduledEventMessageComposer processor without waiting is a message was produced during the last event?

      Thanks very much for you suggestions?

        • 1. Re: ScheduledEventMessageComposer to pickup more than one me
          tfennelly

          Have you considered using the FileGatewayListener?

          If you can't use the FileGatewayListener, I'd look at implementing this slightly differently. This is a throttling issue and there's no "first class" constructs in the ESB for doing this (yet).

          What you could look at is a SchecduledEventListener impl (Vs ScheduledEventMessageComposer - see the docs) as a means of "working out" how much work needs to be done at the current time, queuing this work up in another co-located "worker" style event driven service - e.g. one that listens on a JMS queue.

          Your ScheduledEventListener could read the input dir every X minutes and for every file that needs to be processed, invoke the Worker Service (using the ServiceInvoker) with the name of the file to be processed (or a batch of them). So if there's a backlog of files, you process them all on this iteration of the schedule. You'll obviously need to mange the lifecycle of the input files in some way so as to avoid reprocessing of the same files.

          • 2. Re: ScheduledEventMessageComposer to pickup more than one me

            Thanks for your quick answer!
            I will follow your advice and implement the SchecduledEventListener strategy.
            Mathieu