public static void ReleaseConnection(OtpConnection con) { if (con == null) { return; } con.close(); }
public static void ReleaseConnection(OtpConnection con, IConnectionFactory cf) { if (con == null) { return; } try { con.close(); } catch (Exception ex) { logger.Debug("Could not close Otp Connection", ex); } }
public void TestRawApi() { var self = new OtpSelf("rabbit-monitor"); var hostName = NODE_NAME; var peer = new OtpPeer(hostName); this.connection = self.connect(peer); var encoding = new UTF8Encoding(); OtpErlangObject[] objectArray = { new OtpErlangBinary(encoding.GetBytes("/")) }; this.connection.sendRPC("rabbit_amqqueue", "info_all", new OtpErlangList(objectArray)); var received = this.connection.receiveRPC(); Logger.Info(received); Logger.Info(received.GetType().ToString()); }
/// <summary>Executes the RPC.</summary> /// <param name="con">The con.</param> /// <param name="recycleConnection">if set to <c>true</c> [recycle connection].</param> /// <param name="module">The module.</param> /// <param name="function">The function.</param> private void ExecuteRpc(OtpConnection con, bool recycleConnection, string module, string function) { con.sendRPC(module, function, new OtpErlangList()); var response = con.receiveRPC(); Logger.Debug(module + " response received = " + response); if (recycleConnection) { con.close(); con = this.CreateConnection(); } }
/// <summary>Initializes a new instance of the <see cref="DefaultConnection"/> class.</summary> /// <param name="otpConnection">The otp connection.</param> public DefaultConnection(OtpConnection otpConnection) { this.otpConnection = otpConnection; }