/// <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; }
/// <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)); }
/// <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()); }
/* * 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 Port(OtpSelf self) { Port p = self.createPort(); this._id = p._id; this._creation = p._creation; this._node = p._node; }
/* * 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 Port(OtpSelf self) { Port p = self.createPort(); this._id = p._id; this._creation = p._creation; this._node = p._node; }
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()); }