Beispiel #1
0
        /// <summary>
        /// Opens and inintializes the Endpoint.  This should be called only once prior to closing the endpoint.
        /// </summary>
        /// <param name="cfxHandle">The unique CFX Handle for this endpoint.</param>
        /// <param name="requestUri">The Uri / network address on which this endpoint will listen for incoming requests for this endpoint.  amqp:// prefix
        /// may be used for unencrypted AMQP on port 5672.  amqps:// prefix may be used for secure AMQP on port 5671.  You may also specify
        /// custom ports using normal hostname:port notation.  Authentication may also be specified using standard user notation:  eg.
        /// amqps://user1:password1@myhost/
        /// </param>
        /// <param name="certificate">An X509 certificate that has been loaded from the certificate store.  This is optional, and only must be set when using secure, encrypted AMQPS</param>
        public void Open(string cfxHandle, Uri requestUri = null, X509Certificate2 certificate = null)
        {
            IsOpen = false;

            try
            {
                this.CFXHandle = cfxHandle;

                if (requestUri != null)
                {
                    this.RequestUri  = requestUri;
                    requestProcessor = new AmqpRequestProcessor();
                    requestProcessor.Open(this.CFXHandle, this.RequestUri, certificate);
                    requestProcessor.OnRequestReceived             += RequestProcessor_OnRequestReceived;
                    requestProcessor.OnMessageReceivedFromListener += RequestProcessor_OnCFXMessageReceivedFromListener;
                }

                IsOpen = true;
            }
            catch (Exception ex)
            {
                Cleanup();
                Debug.WriteLine(ex.Message);
            }
        }
Beispiel #2
0
        public void Open(string cfxHandle, Uri requestUri = null)
        {
            IsOpen = false;

            try
            {
                this.CFXHandle = cfxHandle;
                if (requestUri != null)
                {
                    this.RequestUri = requestUri;
                }
                else
                {
                    this.RequestUri = new Uri(string.Format("amqp://{0}:5672", EnvironmentHelper.GetMachineName()));
                }

                requestProcessor = new AmqpRequestProcessor();
                requestProcessor.Open(this.CFXHandle, this.RequestUri);
                requestProcessor.OnRequestReceived += RequestProcessor_OnRequestReceived;

                IsOpen = true;
            }
            catch (Exception ex)
            {
                Cleanup();
                Debug.WriteLine(ex.Message);
            }
        }