I see, so search instead of look up in the Hash. We *do* have some response
time limits so I will have to run some benchmarks to see if this is adequate
given our load.

How about the other part? Not using a Persistent Storage? Does that sound at
all reasonable, or am I completely out of it?

-Mario.

--
I want to change the world but they won't give me the source code.


On Sun, Jul 3, 2011 at 02:53, John Mettraux <[email protected]> wrote:

>
> On Sat, Jul 02, 2011 at 10:03:18PM +0200, Mario Camou wrote:
> >
> > The thing at the moment is that the Storage is persistent while the Hash
> is
> > not. My view is that, either both should be persistent, or both
> > non-persistent (or use timeouts if I continue with the current
> > implementation - which I should be doing anyway). Because of what I said
> in
> > the previous paragraph, I'm more inclined to make everything
> non-persistent.
> >
> > Ideas?
>
> Hello Mario,
>
> when your participant receives the workitem, does it know the id of the
> device to to which it will send ? Your description implies that yes.
>
> You could place that information in the workitem (and not in an in-memory
> hash). When the receiver is handed a reply, you could look at the workitems
> and find the one holding the same device id.
>
> Here is a suggestion :
>
> ---8<---
> class MyParticipant < Ruote::StorageParticipant
>
>  def consume(workitem)
>
>    msg = Message.new(workitem)
>    msg.emit()
>
>    workitem.fields['device_id'] = msg.device_id
>
>    super
>      # will place the workitem in the storage
>  end
> end
>
> class MyReceiver < Ruote::Receiver
>
>  def handle_message(msg)
>
>    workitem = @context.engine.storage_participant.find { |wi|
>      wi.fields['device_id'] == msg.device_id
>    }
>
>    @context.engine.storage_participant.proceed(workitem) if workitem
>      # reply to the engine, but via the storage participant, so that
>      # the workitem is removed from the 'list of waiting workitems'
>  end
> end
> --->8---
>
> It could be slow when there are lots of workitems in storage participants,
> but it's persistent.
>
>
> 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
>

-- 
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