Spring AMQP

org.springframework.erlang.connection
Interface Connection

All Known Subinterfaces:
ConnectionProxy
All Known Implementing Classes:
DefaultConnection

public interface Connection

A simple interface that is used to wrap access to the OtpConnection class in order to support caching of OptConnections via method interception. Note: The surface area of the API is all that is required to implement administrative functionality for the Spring AMQP admin project. To access the underlying OtpConnection, use the method getTargetConnection on the interface ConnectionProxy that is implemented by DefaultConnection.

Author:
Mark Pollack

Method Summary
 void close()
          Close the connection to the remote node.
 com.ericsson.otp.erlang.OtpErlangObject receiveRPC()
          Receive an RPC reply from the remote Erlang node.
 void sendRPC(String mod, String fun, com.ericsson.otp.erlang.OtpErlangList args)
          Send an RPC request to the remote Erlang node.
 

Method Detail

close

void close()
Close the connection to the remote node.


sendRPC

void sendRPC(String mod,
             String fun,
             com.ericsson.otp.erlang.OtpErlangList args)
             throws IOException
Send an RPC request to the remote Erlang node. This convenience function creates the following message and sends it to 'rex' on the remote node:
 { self, { call, Mod, Fun, Args, user } }
 

Note that this method has unpredicatble results if the remote node is not an Erlang node.

Parameters:
mod - the name of the Erlang module containing the function to be called.
fun - the name of the function to call.
args - a list of Erlang terms, to be used as arguments to the function.
Throws:
IOException - if the connection is not active or a communication error occurs.

receiveRPC

com.ericsson.otp.erlang.OtpErlangObject receiveRPC()
                                                   throws IOException,
                                                          com.ericsson.otp.erlang.OtpErlangExit,
                                                          com.ericsson.otp.erlang.OtpAuthException
Receive an RPC reply from the remote Erlang node. This convenience function receives a message from the remote node, and expects it to have the following format:
 { rex, Term }
 

Returns:
the second element of the tuple if the received message is a two-tuple, otherwise null. No further error checking is performed.
Throws:
IOException - if the connection is not active or a communication error occurs.
com.ericsson.otp.erlang.OtpErlangExit - if an exit signal is received from a process on the peer node.
com.ericsson.otp.erlang.OtpAuthException - if the remote node sends a message containing an invalid cookie.

Spring AMQP

Copyright © 2011. All Rights Reserved.