1

I have a scanario whereby I'd like to replay events from a file into JMS respecting the timestamps of each event.

There are many hundreds of thousands of events. Some events are only one or two milliseconds apart some are seconds apart.

Any suggestions on the best way to do this would be very much appreciated.

Dan
  • 9,681
  • 14
  • 55
  • 70

1 Answers1

1

here's what i'd try, and in this order:

  1. use quartz. i dont see why it wont be able to handle hundreads of thousands of events.
  2. if for some reason quartz doesnt fit, i'd take all the event timestamps (you said replay so im assumming you know them all inadvance), order them, and use a main thread + thread pool. the main thread sleep()s for the intervals between consecutive events and when its time to fire an event it sends the task of calling the handler out to the executor. if yo uwant better precision (and can live with busy waiting) i'd avoid sleep() and busywait
radai
  • 23,949
  • 10
  • 71
  • 115