Batch Subscription - what is the interval used for?

37 views
Skip to first unread message

Abraham Menacherry

unread,
Feb 25, 2012, 11:06:05 PM2/25/12
to jetlang-dev
Batch subscriber has the following constructor: ->
BatchSubscriber<Integer> batch = new BatchSubscriber<Integer>(fiber,
cb, 0, TimeUnit.MILLISECONDS);
what is the interval used for, what happens if it is set to 0 as in
the above example.

peter royal

unread,
Feb 27, 2012, 9:39:55 PM2/27/12
to jetla...@googlegroups.com

You can use that to batch events in a list if they occur faster than you can keep up with them.

If interval is 0, then as soon as one event is received it will enqueue a task to process that event.

But, if while processing that event (or awaiting to process it) more events occurs, you will get all the events that have occurred (right up until the batch processing starts).

You may want to use a non-zero interval if you are batching events to send it to a process that can't handle the rate of event generation (like a user interface that you may want to throttle down to 250ms)

-pete

--
(peter.royal|osi)@pobox.com - http://fotap.org/~osi

Reply all
Reply to author
Forward
0 new messages