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, cmd="ps"))
AGREE
julia> request(shell, ShellExecReq(cmd="ps"))
AGREE
julia> shell << ShellExecReq(cmd="ps")
AGREE
julia> close(gw)

For more information, see fjåge gateway API specifications.

Gateway API documentation

Fjage.GatewayType
gw = Gateway([name,] host, port)

Open a new TCP/IP gateway to communicate with fjåge agents from Julia.

Base.closeMethod

Close a gateway connection to the master container.

Base.flushMethod

Flush the incoming message queue.

Fjage.nameMethod
name(gw)

Get the name of the gateway.

Fjage.receiveFunction
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.requestFunction
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.sendMethod
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.subscribeMethod

Subscribe to receive all messages sent to the given topic.

Fjage.unsubscribeMethod

Unsubscribe from receiving messages sent to the given topic.