Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Amazon Simple Workflow Casual

Amazon Simple Workflow Casual

AWS Casual Talks #1 LT

Kenichi Takahashi

November 01, 2013
Tweet

More Decks by Kenichi Takahashi

Other Decks in Programming

Transcript

  1. NZ@BDUJWJUZ@UBTLSC class MyActivityTask < SimpleDelegator! def initialize(original_activity_task)! super original_activity_task! end!

    ...! def to_json! to_hash.to_json! end! ! def to_hash! {! 'taskToken' => task_token,! 'activityId' => activity_id,! 'startedEventId' => started_event_id,! ! 'activityType' => {! 'name' => activity_type.name,! 'version' => activity_type.version,! },! ! 'workflowExecution' => {! 'workflowId' => workflow_execution.workflow_id,! 'runId' => workflow_execution.run_id,! }! ! ‘task_info' => {! # set custom task_info! }! }! end!
  2. NZ@BDUJWJUZ@UBTLSC class MyActivityTask < SimpleDelegator! ...! def self.create_from_attributes(domain, attributes)! aws_attributes

    = attributes.except('task_info')! swf_activity_task = AWS::SimpleWorkflow::ActivityTask.new(! domain,! aws_attributes,! {}! )! ! task = self.new(swf_activity_task)! ! if task_info = attributes['task_info']! # set custom task_info! end! ! task! end! end
  3. BDUJWJUZ@UBTL@QSPEVDFS@CBTFSC class ActivityTaskProducerBase! ...! def process_next_task!! activity_task = activity_task_list.poll_for_single_task! !

    process!(MyActivityTask.new(activity_task))! end! ! def process!(my_activity_task)! MyTaskMode.create(! task_info: my_activity_task.to_json,! # other attributes! )! end! end