Skip to content
nofxx edited this page Sep 12, 2010 · 1 revision

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)

Clone this wiki locally