Open clement-michelet opened 8 years ago
The question is : What do we need ?
We need to add dynamic channels with suchannels. With this, we can reduce events process latency for some standalone events. To address this point, we can use Symfony 2 Process component to run each subchannel process.
What is your point of view?
The process component seems to be a good idea. We should also introduce a parameter to restrict the number of parallel suchannels to avoid to overload the server.
On the configuration level, we could add a groupable
configuration with true
/ false
and a configuration aggregate_by
which is a pointer to the aggregate configuration.
An aggregate configuration is an array of field which will be used to query the events on processing. When a delayable event is dispatched, we check if the dynamic channel associated to the couple of values exists. If not, we create an entry dynamic channel containing the aggregate values.
When processing the dynamic channel, we use the aggregate filter values to select events.
I think it will cover all our needs.
I think we can have a specific config to activate the process of dynamic channels
A listener add a channel in a channel collection in MongoDB to identify a new channel (when the dispatcher create the delay event). A channel may be identified by a specific property of the event Object and a property dynamic true / false to active or not the creation of dynamic channels.
A channel with 0 event will be deleted in order to reduce the channels list. I agree with your point of view : a parameter must be placed to limit the process of dynamic channels
@juchi : What is your point of view?
I'm not sure we need a dedicated channel collection to manage this. Currently the channels are created in the configuration and match a list of event. Maybe we could introduce this dynamic notion in the configuration too and specify a discriminator field in the Event object that will specify how to group similar events into a channel.
As proposed by @pdenis, It could be great to have dynamic channels (or "subchannel"). It will allow to ensure that a set of events is run in one shot and allow to parallelize subchannel.