When would you have an event processor over multiple processing groups?

From the discussion here I have a follow on question regarding event processors and processing groups.

The reference guide itself includes this picture

The picture has one event processor controlling two processing groups.

The question I have: what use cases would necessitate an event processor controlling multiple processing groups? How would that be configured in the app?

So far I have only seen the 1…1 relationship betwen them and am curious about others.

It is indeed very common to have a 1:1 relationship. However, this is not mandatory.

Applications that are expected to run on smaller VMs may benefit from having just a single processor, to reduce the number of concurrently running threads. In that case, you could assign all processing groups to a single processor.

Alternatively, it is possible that different projections require a different Sequencing Policy. This policy defines which events may run in parallel, and which must be executed in the order they appeared in the stream. Yet, the fact that they run with different sequencing policies doesn’t prevent them from running int he same processor.

Hope this clarifies it.

1 Like

And the other half of your question:

Use can use the configuration API to configure this:

(Spring Boot example)

    public ConfigurerModule eventProcessingCustomizer() {
        return configurer -> configurer
                .assignProcessingGroup("someProcessingGroup", "someProcessor")
                .assignProcessingGroup("anotherProcessingGroup", "someProcessor")

In non-Spring situations you’d have direct access to the configure, so the use of a ConfigureModule isn’t necessary.

1 Like