CAP currently supports specifying the number of parallel execution threads for subscribers through the global parameter SubscriberParallelExecuteThreadCount. However, in some scenarios, some subscribers may need to execute serially while others may need to execute in parallel.
Subscribers need to provide a configuration to support the above behavior, while SubscriberParallelExecuteThreadCount still takes effect, which can be used to set the parallelism for subscribers who are not individually configured.
Issue(s) addressed:
1536
Changes:
Removal of UseDispatchingPerGroup
The UseDispatchingPerGroup configuration has been removed and is now the default behavior.
Addition of GroupConcurrent parameter to [CapSubscribe]
A new GroupConcurrent parameter has been added to the [CapSubscribe] attribute for concurrent execution of subscriber methods. Now, the Group corresponds to consumers on independent threads.
Usage & Example:
[CapSubscribe("sample.rabbitmq.hello", Group = "A", GroupConcurrent = 3)]
public void Subscriber(DateTime dateTime)
{
}
By specifying the value of the GroupConcurrent parameter, you set the degree of parallel execution for the subscriber, meaning that the Subscriber method can have up to 3 degrees of parallelism.
Parallel execution requires independent threads, so if no Group parameter is specified, CAP will automatically create a Group using the Name value.
If you have multiple subscribers set to the same Group and have also set the GroupConcurrent value for these subscribers, only the value set by the first subscriber will take effect.
Affected components:
All Broker components.
The Class DispatcherPerGroup has been removed.
Checklist:
[x] I have tested my changes locally
[x] I have added necessary documentation (if applicable)
[ ] I have updated the relevant tests (if applicable)
[x] My changes follow the project's code style guidelines
Description:
CAP currently supports specifying the number of parallel execution threads for subscribers through the global parameter
SubscriberParallelExecuteThreadCount
. However, in some scenarios, some subscribers may need to execute serially while others may need to execute in parallel.Subscribers need to provide a configuration to support the above behavior, while
SubscriberParallelExecuteThreadCount
still takes effect, which can be used to set the parallelism for subscribers who are not individually configured.Issue(s) addressed:
1536
Changes:
The
UseDispatchingPerGroup
configuration has been removed and is now the default behavior.[CapSubscribe]
A new
GroupConcurrent
parameter has been added to the[CapSubscribe]
attribute for concurrent execution of subscriber methods. Now, the Group corresponds to consumers on independent threads.Usage & Example:
By specifying the value of the
GroupConcurrent
parameter, you set the degree of parallel execution for the subscriber, meaning that theSubscriber
method can have up to 3 degrees of parallelism.Parallel execution requires independent threads, so if no
Group
parameter is specified, CAP will automatically create a Group using theName
value.If you have multiple subscribers set to the same Group and have also set the
GroupConcurrent
value for these subscribers, only the value set by the first subscriber will take effect.Affected components:
Checklist:
Reviewers: