Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get last activity name? #9

Open
davidpelaez opened this issue Sep 9, 2013 · 1 comment
Open

How to get last activity name? #9

davidpelaez opened this issue Sep 9, 2013 · 1 comment

Comments

@davidpelaez
Copy link
Contributor

Hi,

I have an on_activity_completed do |task, event| but I don't know how to find the name of the task that just completed. Your gem is by far the cleaneast and easiest SWF solution to use. The recently released aws-flow is so complicated and messy. But I'm stuck and I can't figure out how to write logic in the decider based on what task completed.

Thanks for your work, it's very helpful to have it available.

PS: If there's a better place to put this question please let me knkow.

@fredjean
Copy link
Owner

fredjean commented Sep 9, 2013

Here's how I normally do it:

  decision = register_workflow("hello-world", "1.0.1") do
    initial_activity :hello, "1.0.0"

    on_activity_completed do |task, event|
      completed_event = scheduled_event(task, event)
      case completed_event.attributes.activity_type.name
      when "hello"
        task.schedule_activity_task record.to_activity_type, :input => event.attributes.result
      when "record"
        task.complete_workflow_execution :result => 'success'
      end
    end
  end

(from fredjean/swf_example )

Let me know if this helps....

Would it be a good idea to add a method that makes it easier to pull out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants