GenStage. How do I collect events and transfer them to only one event?

I’ve the following problem. My :producer_consumer gets events from the :producer and merge them together to one new event. Now the :producer_consumer shall transfer that new event to the :consumer.
My problem is that in handle_events everytime a new event comes from the :producer, an event is directly send by the :producer_consumer to the consumer. How can I change that the :producer_consumer will send only to the :consumer, when the merge is done.

I’m reading out a serial message. I do not know the length of it and I get from my :producer pices of that message. The :producer_consumer is parsing the pices together and the consumer will call a function which will analyse the serial message.


1 Like

Instead of returning an event, put the data in the process state. When you’ve accumulated enough pieces to have a full message, return the event and an empty process state buffer


Thank you. It’s working!