Closed Jcouls29 closed 3 years ago
Is your intention to make this usable with MassTransit as well, or just Automatonymous?
In all honesty, I'm new to Automatonymous itself and haven't really touched MassTransit. I wouldn't feel comfortable doing any work outside of this library until I understand it more. If you're saying that this change will require some changes over there, I can definitely help modify to the best of my ability there as well. I had no intention of using MassTransit or modifying it.
No need to modify MassTransit, so long as Automatonymous remains fully compatible with MassTransit after adding the builder features.
@phatboyg Sounds good. I tried to make these changes "additive" in nature and not cause any issues with how folks use it now. Just let me know about creating the static ASM class. If you'd like me to add that and alter the tests to use it, I can. Otherwise, I have completed all the other changes requested.
I'll pull in your changes tonight and look them over again. Thanks!
Still on my todo list...
This has been merged, I changed Create to New since Create is pretty commonly used as an Event name.
Due to a need for a more dynamic setup of workflow, a static method was added to AutomatonymousStateMachine to allow for the builder pattern. New interfaces were created and all current tests were copied and converted to the builder pattern to ensure everything was up to spec.
The general principle is that, by using the builder pattern, anyone can build a system (or framework) on top of this library where the need to build the workflow within the constructor isn't ideal. By allowing the states and events to live outside of the workflow, allows for more flexibility for these type of use cases, especially in a dynamic workflow situation where configurable workflows may be necessary.
Open to any thoughts on this approach.
Example Usage