On Wed, Sep 29, 2010 at 03:00:11PM -0700, Eric wrote:
>
> First, thanks for all the help, I have ruote/ruotekit up and running
> in my project and have been able to model most of my processes with
> very little code. You guys have done some really great work.

Hello Eric, thanks,


> I do have a couple of questions.
> 
> 1.) I have a process that notifies a participant and waits for him/her
> to approve and invoice.  I was  tempted to create a block participant
> that would send an email and NOT reply to the workitem, Then when the
> user approved the invoice reply to the workflow. Should I break up the
> participants in to two steps, 1 for notify and 1 for the human
> participant. The workflows tend to get long and less readable. What is
> the best practice?

At first, please avoid BlockParticipant unless you stay with 1 engine-worker 
couple, else they can execute only where they got declared.

For notifications, I have a application where the StorageParticipant is 
specialized as

---8<---
module MyApp
module Participants

  class Inbox < Ruote::StorageParticipant

    # Wraps the parent consume method to emit email notifications if necessary.
    #
    def consume (workitem)

      if workitem.fields['task_notification']
        MyAppMailer.send_task_notification(workitem)
      end

      super(workitem)
    end
  end
end
end

# ...

RuoteKit.engine.register
  # ...
  catchall MyApp::Participants::Inbox
end
--->8---

Sometimes having two steps (two participants) makes sense too.


> 2.) Is there anyway to tell which workitems did not complete? I set up
> a block participant to count to 2 million and kicked a couple off,
> then I killed the processes. I restarted the engine and the workers
> but could not find the dangling processed.

Well, if you killed the process, then it's right if the engine doesn't see it 
anymore. Wait, you killed the "OS process", understood...

It's time for some manual repair then, the process is stalled,

  http://ruote.rubyforge.org/process_administration.html#re_applying

I still have to implement a method that looks at all the process and does the 
re_applying automatically. For now, it's stuck in manual.


> 3.) Similarly is there a way to query which processes the engine
> thinks are running?

  engine.processes

returns a list of the currently running processes.

This output has a list of errors per process.

  #ps = engine.processes.first
  ps = engine.process(wfid)
  p ps.errors.size

You can also directly ask for errors :

  errs =  engine.errors

I guess your question is related to this feature I still have to implement :

  
http://groups.google.com/group/openwferu-users/browse_thread/thread/ff29f26d6b5fd135


> 4.) Where is the best place to hook authentication into ruotekit. I
> saw several references to authentication for ruote_web2 but I have not
> found any info on ruotekit.

In my app I tend to deny access to _ruote to non-admin users. The workitems are 
seen through classical rails views, not the _ruote web interface.

I have a rack middleware to do the denying, it looks like

---8<---
# lib/my_app/rack/ruote_admin_only.rb

module MyApp
module Rack

  # Only admin users may have access to the /_ruote web console
  #
  class RuoteAdminOnly

    def initialize(app)
      @app = app
    end

    def call(env)
      if env['PATH_INFO'].match(/^\/\_ruote/)
        username = env['rack.session']['username']
        return forbidden unless username
        return forbidden unless Authorization.is_admin?(username)
      end
      @app.call(env)
    end

    protected

    def forbidden
      [ 403,
        { 'Content-Type' => 'text/plain', 'Content-Length' => '9' },
        [ 'forbidden' ] ]
    end
  end
end
end

# config/application.rb

    require Rails.root.join('lib/my_app/rack/ruote_admin_only')
    config.middleware.use MyApp::Rack::RuoteAdminOnly
      #
      # only admins may see the ruote web console

    config.middleware.use RuoteKit::Application
--->8---

The rest of the application is using a standard rails auth/auth scheme.


> 5.) Are there any plans to support Ruotekit as an activeresource?

No plans at all. Last time I looked at ActiveResource there was no hypermedia 
support in it.

If there is a type of client I'd like to support, it's more things like 
restfulie :

  http://restfulie.caelumobjects.com/


Best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to