On Sun, May 16, 2010 at 07:15:23AM -0700, r2p2 wrote:
>
> In jBPM there is a kind of a wait state. It acts like a normal
> activity which is waiting for an incoming notification over the
> engine.
> In my case a workflow activity sent a message to Rails which has sent
> a notification to the browser. The browser (user) hast now 30 seconds
> to acknowledge the notification.
>
> In jBPM it was easy to solve this problem with an timeout inside the
> following waite sate. How would be the solution for this kind of
> problem in Ruote?
Hello Robert,
I'm no expert at jBPM. It seems you're writing about some "webflow". I will do
my best to answer.
In ruote, all expressions have a "wait state". By expression, I mean all the
nodes in a process definition tree. They wait for replies from their child
expressions or for replies from elements outside of the engine.
If you have a participant like :
Ruote.process_definition do
participant :ref => 'notify_user'
end
The participant named "notify_user" will receive a workitem and the process
instance will be stuck until the workitem comes back (with potentially an
updated payload (workitem fields)).
Adding a timeout is easy :
Ruote.process_definition do
participant :ref => 'notify_user', :timeout => '30s'
end
Note that it's OK to simplify like this :
Ruote.process_definition do
participant 'notify_user', :timeout => '30s'
end
or
Ruote.process_definition do
notify_user :timeout => '30s'
end
Now for the participant implementations themselves.
For "human participants", the common practice in ruote is to use a
StorageParticipant. It stores workitems and lets other applications browse
them, update them and be proceeded/forwarded to the engine (to resume in their
process instances).
---8<---
Notifications = engine.register_participant 'notify_user',
Ruote::StorageParticipant
# using a constant for the sake of the explanation
# browsing...
@workitems = Notifications.all
# getting...
@workitem = Notifications[fei]
# updating...
@workitem = Notifications.update(workitem)
# forwarding...
Notifications.reply(workitem)
--->8---
> In my case a workflow activity sent a message to Rails
Since you seem to be doing webflow, lets place your "send_message_to_rails"
thing inside the participant implementation.
---8<---
class RobertParticipant < Ruote::StorageParticipant
def consume (workitem)
super(workitem)
send_message_to_rails
end
end
Notifications = engine.register_participant 'notify_user', RobertParticipant
--->8---
So that Rails may notify the user.
I hope this helps. Questions are welcome, kind 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