상속: OtpLocalNode
예제 #1
0
 /*
  * Intiate and open a connection to a remote node.
  *
  * @exception java.io.IOException if it was not possible to connect to the
  * peer.
  *
  * @exception OtpAuthException if handshake resulted in an authentication
  * error.
  */
 // package scope
 internal OtpConnection(OtpSelf self, OtpPeer other)
     : base(self, other)
 {
     this.self = self;
     queue     = new GenericQueue();
     start();
 }
예제 #2
0
        protected GenericQueue queue; // messages get delivered here

        /*
         * Accept an incoming connection from a remote node. Used by {@link
         * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data
         * received when handshaking with the peer node, when the remote node is the
         * connection intitiator.
         *
         * @exception java.io.IOException if it was not possible to connect to the
         * peer.
         *
         * @exception OtpAuthException if handshake resulted in an authentication
         * error
         */
        // package scope
        internal OtpConnection(OtpSelf self, BufferedTcpClient s)
            : base(self, s)
        {
            this.self = self;
            queue     = new GenericQueue();
            start();
        }
 /// <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>
 /// <remarks></remarks>
 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;
 }
예제 #4
0
        protected GenericQueue queue; // messages get delivered here

        /*
         * Accept an incoming connection from a remote node. Used by {@link
         * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data
         * received when handshaking with the peer node, when the remote node is the
         * connection intitiator.
         * 
         * @exception java.io.IOException if it was not possible to connect to the
         * peer.
         * 
         * @exception OtpAuthException if handshake resulted in an authentication
         * error
         */
        // package scope
        internal OtpConnection(OtpSelf self, BufferedTcpClient s)
            : base(self, s)
        {
            this.self = self;
            queue = new GenericQueue();
            start();
        }
예제 #5
0
        /*
         * Create a unique Erlang port belonging to the local node. Since it isn't
         * meaninful to do so, this constructor is private...
         * 
         * @param self the local node.
         * 
         * @deprecated use OtpLocalNode:createPort() instead
         */
        private OtpErlangPort(OtpSelf self)
        {
            OtpErlangPort p = self.createPort();

            id = p.id;
            creation = p.creation;
            node = p.node;
        }
예제 #6
0
        /*
         * Create a unique Erlang port belonging to the local node. Since it isn't
         * meaninful to do so, this constructor is private...
         *
         * @param self the local node.
         *
         * @deprecated use OtpLocalNode:createPort() instead
         */
        private OtpErlangPort(OtpSelf self)
        {
            OtpErlangPort p = self.createPort();

            id       = p.id;
            creation = p.creation;
            node     = p.node;
        }
        public void AfterPropertiesSet()
        {
            AssertUtils.IsTrue(this.selfNodeName != null || this.peerNodeName != null,
                               "'selfNodeName' or 'peerNodeName' is required");
            if (this.cookie == null)
            {
                this.otpSelf = new OtpSelf(this.selfNodeName);
            }
            else
            {
                this.otpSelf = new OtpSelf(this.selfNodeName, this.cookie);
            }

            this.otpPeer = new OtpPeer(this.peerNodeName);
        }
        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());
        }
예제 #9
0
 /*
  * Intiate and open a connection to a remote node.
  * 
  * @exception java.io.IOException if it was not possible to connect to the
  * peer.
  * 
  * @exception OtpAuthException if handshake resulted in an authentication
  * error.
  */
 // package scope
 internal OtpConnection(OtpSelf self, OtpPeer other)
     : base(self, other)
 {
     this.self = self;
     queue = new GenericQueue();
     start();
 }
예제 #10
0
 /**
  * Create an {@link OtpServer} from an existing {@link OtpSelf}.
  * 
  * @param self
  *                an existing self node.
  * 
  * @exception java.io.IOException
  *                    if a ServerSocket could not be created.
  * 
  */
 public OtpServer(OtpSelf self)
     : base(self.Node, self.Cookie)
 {
 }
예제 #11
0
 public OtpConnection connect(OtpSelf self)
 {
     return(new OtpConnection(self, this));
 }
        /// <summary>
        /// Afters the properties set.
        /// </summary>
        /// <remarks></remarks>
        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();
                this.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());
        }
예제 #13
0
 /*
  * Intiate and open a connection to a remote node.
  */
 internal OtpConnection(OtpSelf self, OtpPeer peer)
     : base(self, peer)
 {
     Self = self;
     Start();
 }
예제 #14
0
 /*
  * Accept an incoming connection from a remote node. Used by {@link
  * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data
  * received when handshaking with the peer node, when the remote node is the
  * connection intitiator.
  */
 internal OtpConnection(OtpSelf self, IOtpTransport socket)
     : base(self, socket)
 {
     Self = self;
     Start();
 }
예제 #15
0
 /**
  * Create an {@link OtpServer} from an existing {@link OtpSelf}.
  *
  * @param self
  *                an existing self node.
  *
  * @exception java.io.IOException
  *                    if a ServerSocket could not be created.
  *
  */
 public OtpServer(OtpSelf self)
     : base(self.Node, self.Cookie)
 {
 }
예제 #16
0
 public OtpConnection connect(OtpSelf self)
 {
     return new OtpConnection(self, this);
 }
 /// <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);
 }