Spring AMQP

org.springframework.erlang.connection
Class DefaultConnection

java.lang.Object
  extended by org.springframework.erlang.connection.DefaultConnection
All Implemented Interfaces:
Connection, ConnectionProxy

public class DefaultConnection
extends Object
implements ConnectionProxy

Basic implementation of ConnectionProxy that delegates to an underlying OtpConnection.

Author:
Mark Pollack

Constructor Summary
DefaultConnection(com.ericsson.otp.erlang.OtpConnection otpConnection)
           
 
Method Summary
 void close()
          Close the connection to the remote node.
 com.ericsson.otp.erlang.OtpConnection getTargetConnection()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConnection

public DefaultConnection(com.ericsson.otp.erlang.OtpConnection otpConnection)
Method Detail

close

public void close()
Description copied from interface: Connection
Close the connection to the remote node.

Specified by:
close in interface Connection

sendRPC

public void sendRPC(String mod,
                    String fun,
                    com.ericsson.otp.erlang.OtpErlangList args)
             throws IOException
Description copied from interface: Connection
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.

Specified by:
sendRPC in interface Connection
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

public com.ericsson.otp.erlang.OtpErlangObject receiveRPC()
                                                   throws IOException,
                                                          com.ericsson.otp.erlang.OtpErlangExit,
                                                          com.ericsson.otp.erlang.OtpAuthException
Description copied from interface: Connection
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 }
 

Specified by:
receiveRPC in interface Connection
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.

getTargetConnection

public com.ericsson.otp.erlang.OtpConnection getTargetConnection()
Specified by:
getTargetConnection in interface ConnectionProxy

Spring AMQP

Copyright © 2011. All Rights Reserved.