On Mon, Jun 21, 2010 at 05:19:07PM +0100, David Greaves wrote: > I have forked ruote-amqp (actually based on john's fork) and > daemon-kit and have a few patches which may be useful > > http://github.com/lbt/ruote-amqp/commits/ruote2.1/ > Document deprecation of :reply_queue and use of 'ruote_workitems' > Support :command => '' and :queue => '' in register_participant() options: > > FYI : I'm planning on removing :reply_by_default in favour of the > generic :forget and I think this should be passed through to the > remote participant so it knows not to send a reply back. > > http://github.com/lbt/daemon-kit/commits/master/ > Reply via 'ruote_workitems' for ruote-amqp 2.1.10
Hello David, thanks for your work on ruote-amqp, I have integrated it. I first adapted the spec suite to it : http://github.com/jmettraux/ruote-amqp/commit/e55999ec49ad4920ac468b66fba1a906639b14cc Then I removed the 'command' thing and replaced it with workitem.params['participant_options'] http://github.com/jmettraux/ruote-amqp/commit/60348ff62c764821cbd71f58276fcd8658657ee3 This is how it works : http://github.com/jmettraux/ruote-amqp/blob/ruote2.1/spec/participant_spec.rb#L134-167 'command' is too specific. The better way : ---8<--- # # engine side ... engine.register_participant :run_command, RuoteAMQP::Participant, 'queue' => 'command_queue' engine.register_participant :delete_user, RuoteAMQP::Participant, 'queue' => 'command_queue', 'command' => 'delete_user' pdef = Ruote.process_definition do sequence do delete_user run_command :command => 'collect_garbage' end end # # over the AMQP fence ... MQ.queue('command_queue').subscribe do |msg| workitem = JSON.parse(msg) params = workitem['fields']['params'] command = params['command'] || params['participant_options']['command'] result = run(command) reply_queue = params['reply_queue'] || params['participant_options']['reply_queue'] workitem['fields']['command_result'] = result MQ.queue(reply_queue).publish( workitem.to_json ) end --->8--- Please note the 'reply_queue' is also leveraging the params / options technique. Daemon-kit generated participants could easily be adapted to this technique. ---8<--- def get_option (key, workitem) params = workitem['fields']['params'] # or simply workitem.params params[key] || params['participant_options'][key] end --->8--- I have also removed your deprecation warnings since you removed the deprecated things altogether. Thanks again, good work ! -- 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
