/// <summary>Initializes a new instance of the <see cref="ConnectionParameters"/> class.</summary>
 /// <param name="otpSelf">The otp self.</param>
 /// <param name="otpPeer">The otp peer.</param>
 public ConnectionParameters(OtpSelf otpSelf, OtpPeer otpPeer)
 {
     AssertUtils.ArgumentNotNull(otpSelf, "OtpSelf must be non-null");
     AssertUtils.ArgumentNotNull(otpPeer, "OtpPeer must be non-null");
     this.otpSelf = otpSelf;
     this.otpPeer = otpPeer;
 }
Пример #2
0
        /// <summary>Creates the connection.</summary>
        /// <returns>The Erlang.NET.OtpConnection.</returns>
        public OtpConnection CreateConnection()
        {
            var self = new OtpSelf("rabbit-monitor-" + counter++);
            var peer = new OtpPeer(NODE_NAME);

            return(self.connect(peer));
        }
Пример #3
0
        /// <summary>
        /// Afters the properties set.
        /// </summary>
        public void AfterPropertiesSet()
        {
            AssertUtils.IsTrue(this.selfNodeName != null || this.peerNodeName != null, "'selfNodeName' or 'peerNodeName' is required");

            var selfNodeNameToUse = this.selfNodeName;

            selfNodeNameToUse = string.IsNullOrEmpty(selfNodeNameToUse) ? string.Empty : selfNodeNameToUse;
            if (this.UniqueSelfNodeName)
            {
                selfNodeNameToUse = this.selfNodeName + "-" + Guid.NewGuid().ToString();
                Logger.Debug("Creating OtpSelf with node name = [" + selfNodeNameToUse + "]");
            }

            try
            {
                if (StringUtils.HasText(this.cookie))
                {
                    this.otpSelf = new OtpSelf(selfNodeNameToUse.Trim(), this.cookie);
                }
                else
                {
                    this.otpSelf = new OtpSelf(selfNodeNameToUse.Trim());
                }
            }
            catch (IOException e)
            {
                throw new OtpIOException(e);
            }

            this.otpPeer = new OtpPeer(string.IsNullOrEmpty(this.peerNodeName) ? string.Empty : this.peerNodeName.Trim());
        }
Пример #4
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());
        }