| Class | Ruote::StorageParticipant |
| In: |
lib/ruote/part/storage_participant.rb
|
| Parent: | Object |
A participant that stores the workitem in the same storage used by the engine and the worker(s).
part = engine.register_participant 'alfred', Ruote::StorageParticipant
# ... a bit later
puts "workitems still open : "
part.each do |workitem|
puts "#{workitem.fei.wfid} - #{workitem.fields['params']['task']}"
end
# ... when done with a workitem
part.reply(workitem)
# this will remove the workitem from the storage and hand it back
# to the engine
Does not thread by default (the engine will not spawn a dedicated thread to handle the delivery to this participant, the workitem will get stored via the main engine thread and basta).
| context | [RW] |
field : returns all the workitems with the given field name present.
field and value : returns all the workitems with the given field name and the given value for that field.
Warning : only some storages are optimized for such queries (like CouchStorage), the others will load all the workitems and then filter them.
A convenience method (especially when testing), returns the first (only ?) workitem in the participant.
Queries the store participant for workitems.
Some examples :
part.query(:wfid => @wfid).size
part.query('place' => 'nara').size
part.query('place' => 'heiankyou').size
part.query(:wfid => @wfid, :place => 'heiankyou').size
There are two ‘reserved’ criterion : ‘wfid’ and ‘participant’ (‘participant_name’ as well). The rest of the criteria are considered constraints for fields.
‘offset’ and ‘limit’ are reserved as well. They should prove useful for pagination.
Note : the criteria is AND only, you‘ll have to do ORs (aggregation) by yourself.