Last active
October 13, 2017 10:03
-
-
Save geomagilles/7536a0c5c4d53e1811b6b0f9945709ee to your computer and use it in GitHub Desktop.
Python example of workflow implementation using Zenaton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrderWorkflow(Workflow): | |
def __init__(self, item, address): | |
self.item = item | |
self.address = address | |
def handle(self): | |
self.execute(PrepareOrder(self.item)) | |
event = self.execute(Wait(OrderPreparedEvent)) | |
self.execute(SendOrder(event.id, self.item, self.address)) | |
def on_event(self, event): | |
if isinstance(event, AddressUpdatedEvent): | |
self.address = event.address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment