Gateway
Example usage
In Julia REPL:
julia> using Fjage
julia> gw = Gateway("localhost", 1100);
julia> shell = agentforservice(gw, "org.arl.fjage.shell.Services.SHELL")
shell
julia> shell.language
"Groovy"
julia> request(gw, ShellExecReq(recipient=shell, command="ps"))
AGREE
julia> request(shell, ShellExecReq(command="ps"))
AGREE
julia> shell << ShellExecReq(command="ps")
AGREE
julia> close(gw)For more information, see fjåge gateway API specifications.
Gateway API documentation
Fjage.Gateway — Typegw = Gateway([name,] host, port)Open a new TCP/IP gateway to communicate with fjåge agents from Julia.
Base.close — MethodClose a gateway connection to the master container.
Base.flush — MethodFlush the incoming message queue.
Fjage.agentforservice — MethodFind an agent that provides a named service.
Fjage.agentsforservice — MethodFind all agents that provides a named service.
Fjage.name — Methodname(gw)Get the name of the gateway.
Fjage.receive — Functionmsg = receive(gw[, filter][, timeout])Receive an incoming message from other agents or topics. Timeout is specified in milliseconds. If no timeout is specified, the call is non-blocking. If a negative timeout is specified, the call is blocking until a message is available.
If a filter is specified, only messages matching the filter are retrieved. A filter may be a message type, a message or a function. If it is a message type, only messages of that type or a subtype are retrieved. If it is a message, any message whose inReplyTo field is set to the msgID of the specified message is retrieved. If it is a function, it must take in a message and return true or false. A message for which it returns true is retrieved.
Fjage.request — Functionrsp = request(gw, msg[, timeout])Send a request via the gateway to the specified agent, and wait for a response. The response is returned. The recipient field of the request message (msg) must be populated with an agentID. The timeout is specified in milliseconds, and defaults to 1 second if unspecified.
Fjage.send — Methodsend(gw, msg)Send a message via the gateway to the specified agent. The recipient field of the message must be populated with an agentID.
Fjage.subscribe — MethodSubscribe to receive all messages sent to the given topic.
Fjage.unsubscribe — MethodUnsubscribe from receiving messages sent to the given topic.