On Tue, Mar 23, 2010 at 11:13 PM, Pavel Myuller <[email protected]> wrote:
> Hi, everyone!

Hello Pavel,

> I'm examining ruote (gem 2.1.8) to use in my project and have some
> questions
> to developers:
>
> 1. John Mettraux wrote in his post 
> http://jmettraux.wordpress.com/2009/12/31/ruote-2-1-released/
> "...a persisted workqueue can be shared by multiple workers, workers
> not in the same Ruby process...".
>
> That's great, but i can't realize how it's implemented.
> For example, i have two separate ruby OS processes with one worker in
> each and shared (let it be cloche) storage being served by them.
> At some moment of time client launches new process.
> Corresponding message is being pushed into storage.
> Then both workers (they're idle at that moment) fetch it in their
> "step" method and begin to process it. Do we have two instances of
> same business process running, or i miss something?

No there will be only one instance.

Both workers will fetch the launch message and the first one that can
"reserve" the message will have the right to process it. Same thing
for all the subsequent messages. This also means that the execution of
1 process may span multiple workers.


> Where should i look to find some "message locking" mechanism?

  http://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/worker.rb#L215

The "reserve" operation is in fact a delete. If the delete returns nil
(meaning no conflict), the worker knows it can safely process the
message.

Of course, the underlying details depend on the storage implementation.

  
http://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/storage/hash_storage.rb#L91-116
  
http://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/storage/fs_storage.rb#L79-82
  
http://github.com/jmettraux/rufus-cloche/blob/master/lib/rufus/cloche.rb#L124-161

and so on...


> 2. Transactions.
> I need some kind of "all or nothing" mechanism in my processes. For
> examlpe:
>
> <transaction>
>    <participant ref="deliver_report"/> <!-- make report visible to
> customer -->
>    <participant ref="withdraw"/> <!-- take some money from him -->
> </transaction>
>
> Is there any obvious implementation of this feature in ruote? Or maybe
> simple simulation with other techniques?

Please have a look at :on_cancel and at undo/redo :

  http://ruote.rubyforge.org/common_attributes.html#on_cancel
  http://ruote.rubyforge.org/exp/undo.html
  http://ruote.rubyforge.org/exp/redo.html
  http://ruote.rubyforge.org/exp/cancel_process.html

You can wire a "compensation" participant or subprocess to an :on_cancel tag.


> Thanks in advance! and sorry for my English in advance :)

No worries ! Questions and suggestions are welcome, 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

To unsubscribe from this group, send email to 
openwferu-users+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to