Object
This participant emits workitems towards a beanstalk queue.
engine.register_participant(
:heavy_labour,
:reply_by_default => true, :beanstalk => '127.0.0.1:11300')
Workitems are encoded in the format
[ 'workitem', workitem.to_h ]
and then serialized as JSON strings.
Like workitems, but the format is
[ 'cancelitem', fei.to_h, flavour.to_s ]
where fei is the FlowExpressionId of the expression getting cancelled (and whose workitems are to be retired) and flavour is either ‘cancel’ or ‘kill’.
Extend and overwrite encode_workitem and encode_cancelitem or simply re-open the class and change those methods.
Indicates which beanstalk to talk to
engine.register_participant(
'alice'
Ruote::Beanstalk::ParticipantProxy,
'beanstalk' => '127.0.0.1:11300')
Most of the time, you want the workitems (or the cancelitems) to be emitted over/in a specific tube
engine.register_participant(
'alice'
Ruote::Beanstalk::ParticipantProxy,
'beanstalk' => '127.0.0.1:11300',
'tube' => 'ruote-workitems')
If the participant is configured with ‘reply_by_default’ => true, the participant will dispatch the workitem over to Beanstalk and then immediately reply to its ruote engine (letting the flow resume).
engine.register_participant(
'alice'
Ruote::Beanstalk::ParticipantProxy,
'beanstalk' => '127.0.0.1:11300',
'reply_by_default' => true)
# File lib/ruote/beanstalk/participant_proxy.rb, line 122
122: def cancel(fei, flavour)
123:
124: con = new_connection
125:
126: con.put(encode_cancelitem(fei, flavour))
127:
128: ensure
129: con.close rescue nil
130: end
# File lib/ruote/beanstalk/participant_proxy.rb, line 110
110: def consume(workitem)
111:
112: con = new_connection
113:
114: con.put(encode_workitem(workitem))
115:
116: reply(workitem) if @opts['reply_by_default']
117:
118: ensure
119: con.close rescue nil
120: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.