Note
The cloning process is taken before processing each subscriber. Therefore, registering or unregistering subscriber does never interfere the sequences that are executing.
A sequence of subscribers is executing upon publisher requests.
When a request from publisher is received, a sequence of jobs is processing one by one.
Invokes ArgumentConvertingCallback defined in MessageBusPublisherOptions.
Clones the sequence of the current linked subscribers.
For each sequence:
Invokes ConditionCheckingCallback defined in MessageBusSubscriberOptions. If presents and false / False returned, the subscriber is skipped.
Invokes ArgumentConvertingCallback defined in MessageBusSubscriberOptions.
Runs the callback of the subscriber.
If the subscriber has return value:
Invokes ResultCheckingCallback defined in MessageBusSubscriberOptions.
Invokes ReturnValueConvertingCallback defined in MessageBusSubscriberOptions.
If the subscriber do NOT have return value: Checks IsFinal defined in MessageBusSubscriberOptions.
Determines whether the result is accepted.
For each left sequence which need to be execute (IsAlwaysExecuteAll in MessageBusPublisherOptions or IsAlwaysExecution in MessageBusSubscriberOptions):
Invokes ConditionCheckingCallback defined in MessageBusSubscriberOptions. If presents and false / False returned, the subscriber is skipped.
Invokes ArgumentConvertingCallback defined in MessageBusSubscriberOptions.
Runs the callback of the subscriber.
If the executor need return value:
If accepted result is generated from one subscriber: Invokes ReturnValueConvertingCallback defined in MessageBusPublisherOptions.
If accepted result is NOT generated from one subscriber: Takes DefaultReturnValue defined in MessageBusPublisherOptions.
Returns the value.
If the executor do NOT need return value: Returns.
An instance of MessageInstance is creates every time the publisher requests.
The instance of MessageInstance contains an unique id that is different for each execution requested from executor and the message name. When IsSubscriberReturnValueAccepted is true / True, the instance contains the id and the returned value (if available) from the subscriber which generated the accepted return value.
Subscribers can get the instance of MessageInstance through the parameter. When required, defines the method with the right signature. See Subscriber Register for details.
After publisher executed, the instance of MessageInstance can be returned in 3 ways:
After ExecuteAndGetMessageInstance (ExecuteAndGetMessageInstance and ExecuteAndGetMessageInstance) called, the instance of MessageInstance is placed as the 2nd parameter.
After ExecuteAndGetMessageInstanceAsync called, the instance of MessageInstance is wrapped in the task returned.
After ExecuteAndGetMessageInstanceAsync called, the instance of MessageInstance is placed as MessageInstance, which is wrapped in the task returned.
When IsSubscriberReturnValueAccepted is true / True, the instance contains the id and the returned value (if available) from the subscriber which generated the accepted return value. Converts the instance into MessageInstanceWithReturnValueBase for further checking:
If SubscriberReturnValueType is void, the type of the instance is SubscriberReturnValueType. There is no value included due to void returned.
If SubscriberReturnValueType is null / Nothing, the type of the instance is SubscriberReturnValueType. The return value is included but the type is unclear because it is converted by ReturnValueConvertingCallback defined in MessageBusSubscriberOptions.
Otherwise, the type of the instance is SubscriberReturnValueType, including the value generated from the subscriber.
Otherwise,