Concurrent Data Processing in Elixir: Incorrect Description of handle_events behavior: (page 81)

The text currently reads:

“ This means that the handle_events/3 callback will be called with a list of 500 events initially, followed by another 500 ”

It should read:
“ This means that the handle_events/3 callback will be called with a list of 1000 events initially, followed by another 500 ”

The graph below this paragraph show the correct flow of information, the text just doesn’t align with it.

The text is actually correct, so perhaps the graph is misleading. Each box on the consumer timeline contains 500 events, which is the supplied 1000 events broken in two batches. Does that make sense? Maybe I should clarify that the box represents a batch, not “total received”? What do you think?

1 Like

Huh, how interesting. Perhaps my understanding is flawed then.

I was under the impression with a 1000 max and 500 min that an initial request for 1000 would be send to Producer. It would respond with those 1000 events which the consumer would split into batches of 500 and start processing.

Then the Consumer would request an additional 500 events once the first batch of 500 was complete.

Is that correct?

Yes, that’s correct. And handle_events/3 will be called with each batch. Therefore, you get a list of 500 events, first, and then the remaining 500. After the second batch of 500, all 1000 events will be processed.

Ok got it. I think the confusion was in the distinction between sending 1000 events from the producer initially, but only getting the 500 in the handle_events/3 function at a time.

Thanks for the clarification.

No problem at all, I took a note to go through this section of the book again. Maybe I can improve it to make it a bit easier. Thanks for your feedback!