You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature related to a problem? Please describe.
While in general there are cases where it makes sense to find other ways instead of trying to send messages from recoverability, here are valid use cases to do so. Here is an example from a customer case:
We have a client Application which starts a Saga. The saga receives a zip file(package) and must distributed it to different services. For each service there is a specific handler made for.
The handler makes an http POST request to an API. For this request we use a httpclient component not made by ourselves. This httpclient component gives back an OK or an ApiException. In that case we immediately send back a PackagePublished failed event So the saga can complete with a reply to the client with the state of failed.
Now if there is any other exception maybe by the handler itself or by the httpclient we are going into the NServicebus default retries. After the retries the message is going into the error queue. Now when it does go to error queue we also want to complete the saga. So the idea is to use the recoverability failed notification with the FailedMessage and if the failed message is of type PublishPackage then make a PackagePublishedFailed message for the saga.
More details in case 00085737
Currently the error notification delegates do not give access to any means of sending messages (nor the service provider to resolve something). The recoverability pipeline stages are working on a very low-level routing and are not really suitable for sending out higher level messages. So currently the only way to achieve this is by adding a behavior into the recoverability stage that gets access to the message session
class RecoverabilityBehavior(IMessageSessionmessageSession,ILogger<RecoverabilityBehavior>logger):Behavior<IRecoverabilityContext>{
public override async Task Invoke(IRecoverabilityContextcontext,Func<Task>next){
if (context.RecoverabilityAction isMoveToError&& context.Metadata.TryGetValue("NServiceBus.ExceptionInfo.Data.Message type",outvar messageType)&& messageType.Equals(nameof(MyMessage))){
logger.LogInformation("MyMessage failed. Publishing MyMessageFailed event.");
var message =new MyMessageFailed();await messageSession.Publish(message, context.CancellationToken);}
await next();}}
On top of that here is no more any batching guarantees available even though we could probably support it in various transports.
Describe the requested feature
Have an ability to send/publish messages from recoverability.
Describe alternatives you've considered
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Describe the feature.
Is your feature related to a problem? Please describe.
While in general there are cases where it makes sense to find other ways instead of trying to send messages from recoverability, here are valid use cases to do so. Here is an example from a customer case:
More details in case
00085737
Currently the error notification delegates do not give access to any means of sending messages (nor the service provider to resolve something). The recoverability pipeline stages are working on a very low-level routing and are not really suitable for sending out higher level messages. So currently the only way to achieve this is by adding a behavior into the recoverability stage that gets access to the message session
On top of that here is no more any batching guarantees available even though we could probably support it in various transports.
Describe the requested feature
Have an ability to send/publish messages from recoverability.
Describe alternatives you've considered
Additional Context
No response
The text was updated successfully, but these errors were encountered: