public
Description: self assembling fabric of ruby daemons
Home | Edit | New

Client-Agent

You can call your agents from within an agent. Here is how it works:

client-agent example

Check out the client-agent folder on the repository.

  1. Make sure you have AMQP setup properly (simpleagent example Testing Nanite)
  2. run a simple agent (‘nanite-agent —token fred’) in examples/simpleagent
  3. run ‘nanite-agent —token client’ in this folder
  4. run ./cli.rb

What’s going on:

The cli.rb mapper sends a request to the client agent, asking for the delegate method:

Nanite.request("/client/delegate", ["/simple/echo", "echo said hello world!"]) do |res|
...

Client agent receives the request and make another request to the nanite we sent as payload (“/simple/echo”)

request(nanite, payload) do |res|
...

And finally, simple agent receives and echo it back to client and then to the mapper.

Obs: “push” is only avaiable on the repository. (sep/09)

Last edited by nofxx, Fri Sep 11 22:14:21 -0700 2009
Home | Edit | New
Versions: