/// <summary>Releases the connection.</summary>
        /// <param name="con">The con.</param>
        public static void ReleaseConnection(OtpConnection con)
        {
            if (con == null)
            {
                return;
            }

            con.close();
        }
Beispiel #2
0
        /// <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();
            }
        }
Beispiel #3
0
        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());
        }
Beispiel #4
0
 /// <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;
 }