Compensate method being called on activity and it shouldn't be called

55 views
Skip to first unread message

Emir Ključanin

unread,
Sep 25, 2017, 3:54:23 PM9/25/17
to masstransit-discuss
I know the question is not that clear so I'll try to explain my issue as best as I can here.
So I have three activities in my routing slip:
- CreateActiveDirectoryUser Activity
- CreateIdentityServerUser ExecuteActivity
- SendNotificationsToUser ExecuteActivity

and they are in this order in routing slip.
As you can see last two activities are ExecuteActivities, SendNotificationsToUser  is the last activity in routing slip and if it fails it doesn't matter as it is not business critical so I don't have a need to compensate CreateIdentityServerUser. 
The problem is that if SendNotificationsToUser has an exception Compensate method of CreateActiveDirectoryUser is called, and in this scenario I only need CreateActiveDirectoryUser  Compensate method to be called if CreateIdentityServerUser  fails.

I hope I explained my problem clearly.
Is there any solution for this?
Thank you

Chris Patterson

unread,
Sep 25, 2017, 7:28:31 PM9/25/17
to masstrans...@googlegroups.com
IF that is the case, and the notification is truly unimportant, it shouldn't be part of the routing slip. If anything, the final activity in the routing slip should publish an event which is then used by a regular consumer to deliver the notification. That way, it can be processed separately, outside of the transaction, with a separate retry policy for that event.

Does that make sense?

By the activity failing, it's indicating that the overall routing slip transaction faulted, and any successful activities should be compensated.


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/03e8a0a0-9248-4466-8399-5784e32514ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Emir Ključanin

unread,
Sep 26, 2017, 2:35:59 AM9/26/17
to masstransit-discuss
Actually it makes perfect sense :).
Thank you very much for the explanation.


On Tuesday, September 26, 2017 at 1:28:31 AM UTC+2, Chris Patterson wrote:
IF that is the case, and the notification is truly unimportant, it shouldn't be part of the routing slip. If anything, the final activity in the routing slip should publish an event which is then used by a regular consumer to deliver the notification. That way, it can be processed separately, outside of the transaction, with a separate retry policy for that event.

Does that make sense?

By the activity failing, it's indicating that the overall routing slip transaction faulted, and any successful activities should be compensated.

On Mon, Sep 25, 2017 at 1:54 PM, Emir Ključanin <emir.kl...@gmail.com> wrote:
I know the question is not that clear so I'll try to explain my issue as best as I can here.
So I have three activities in my routing slip:
- CreateActiveDirectoryUser Activity
- CreateIdentityServerUser ExecuteActivity
- SendNotificationsToUser ExecuteActivity

and they are in this order in routing slip.
As you can see last two activities are ExecuteActivities, SendNotificationsToUser  is the last activity in routing slip and if it fails it doesn't matter as it is not business critical so I don't have a need to compensate CreateIdentityServerUser. 
The problem is that if SendNotificationsToUser has an exception Compensate method of CreateActiveDirectoryUser is called, and in this scenario I only need CreateActiveDirectoryUser  Compensate method to be called if CreateIdentityServerUser  fails.

I hope I explained my problem clearly.
Is there any solution for this?
Thank you

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages