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 — Type
gw = Gateway([name,] host, port)Open a new TCP/IP gateway to communicate with fjåge agents from Julia.
Base.close — Method
Close a gateway connection to the master container.
Base.flush — Method
Flush the incoming message queue.
Fjage.agentforservice — Function
Find an agent that provides a named service.
Fjage.agents — Function
Find all agents running on the master container.
Fjage.agentsforservice — Function
Find all agents that provide a named service.
Fjage.containsagent — Function
Check if an agent is running on the master container.
Fjage.name — Method
name(gw)Get the name of the gateway.
Fjage.receive — Function
msg = 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 — Function
rsp = 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 — Method
send(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.services — Function
Find all services available on the master container.
Fjage.subscribe — Method
Subscribe to receive all messages sent to the given topic.
Fjage.unsubscribe — Method
Unsubscribe from receiving messages sent to the given topic.