Created
November 7, 2012 22:46
-
-
Save rebo/4035073 to your computer and use it in GitHub Desktop.
saga outline
This file contains 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 CreatePartyAccountOrderSaga < Saga | |
attr_reader :saga_info | |
def initialize(saga_id, party_attributes, account_attributes, order_attributes) | |
@saga_id = saga_id; | |
start(party_attributes, account_attributes, order_attributes) | |
end | |
def start(party_attributes, account_attributes, order_attributes) | |
fiber_based_workflow do | |
party_id = saga_exec("Creating Party..."){CreateParty.execute(*party_attributes)} | |
raise CreatePartyFailedError, "Party Creation Failed" if timeout? | |
account_id = saga_exec("Creating Account..."){CreateAccount.execute(party_id, *account_attributes)} | |
raise CreateAccountFailedError, "Account Creation Failed"} if timeout? | |
order_id = saga_exec("Creating Order..."){CreateOrder.execute(account_id, *order_attribtues)} | |
raise CreateOrderFailedError, "Order Creation Failed"} if timeout? | |
saga_success(order_id) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment