CAP icon indicating copy to clipboard operation
CAP copied to clipboard

Question about parallel execution

Open PoteRii opened this issue 1 year ago • 4 comments

Hello, Scenario: Service is consuming events from multiple topics (A and B). I need to retain order and sequential processing for topic A, but need to execute events in parallel for topic B. How can this be achieved?

PoteRii avatar May 13 '24 08:05 PoteRii

Hello,

CAP's parallel execution configuration is global and does not support separate settings for subscribers.

yang-xiaodong avatar May 13 '24 14:05 yang-xiaodong

any plans to add this feature? or any hints how we can do it?

PoteRii avatar May 13 '24 14:05 PoteRii

These are some hints that might be useful for your short-term solution, we still need to investigate whether to add this feature or not.

  1. Place subscribers that require parallel execution into one or more groups, e.g., parallel-group-1, parallel-group-2.
[CapSubscribe("A", Group="parallel-group-1")]
public void SubA(){
}

[CapSubscribe("B", Group="parallel-group-2")]
public void SubA(){
}
  1. Set the UseDispatchingPerGroup option to true.
  2. Modify IDispatcher.PerGroup.cs line 203 as follows :
if (_enableParallelExecute || key =="parallel-group-1.v1" || key== "parallel-group-2.v1"){

}

yang-xiaodong avatar May 13 '24 14:05 yang-xiaodong

Thanks, will dive deeper

PoteRii avatar May 13 '24 14:05 PoteRii

We plan to support consumer concurrent in v8.2.0, please check out the PR #1537 !

yang-xiaodong avatar May 27 '24 08:05 yang-xiaodong

@PoteRii Version 8.2.0-preview-233720681 is released, take a try.

yang-xiaodong avatar May 29 '24 08:05 yang-xiaodong