MassTransit / Automatonymous

A state machine library for .Net - 100% code - No doodleware
Apache License 2.0
736 stars 116 forks source link

Scheduled expirationId / tokenId usage #45

Closed svechin closed 6 years ago

svechin commented 6 years ago

Could someone explain meaning of expirationId / tokenId in scheduled event ?

Schedule(() => CartExpired, x => x.ExpirationId ??????, x => { ..... });

Documentation says "This is an identifier that is used by the state machine's scheduling feature, to capture the scheduled message identifier". But it's not clear if this is property which saga needs only for internal needs or you can use it somehow to control scheduled event.

p.s. if there is better description somewhere please point.

Thanks.

phatboyg commented 6 years ago

When a message is scheduled, a TokenId is generated that identifies the scheduled message. If the message scheduler supports cancellation (which Quartz does), and the state machine later tries to Unschedule() the message (such as cancelling a future timeout message), that tokenId is used to cancel the previously scheduled message.

If it isn't saved, the message cannot be cancelled. It should be a nullable property in the saga persistence definition.

svechin commented 6 years ago

thanks!