当前位置: 首页>>代码示例>>C#>>正文


C# Exchange类代码示例

本文整理汇总了C#中Exchange的典型用法代码示例。如果您正苦于以下问题:C# Exchange类的具体用法?C# Exchange怎么用?C# Exchange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Exchange类属于命名空间,在下文中一共展示了Exchange类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createListener

        protected RabbitListener createListener(IRegistration registration, Exchange exchange)
        {
            // create a channel
            var connection = _connFactory.ConnectTo(exchange);

            // create a listener
            RabbitListener listener = new RabbitListener(registration, exchange, connection);
            listener.OnEnvelopeReceived += dispatcher =>
                {
                    Log.Debug("Got an envelope from the RabbitListener: dispatching.");
                    // the dispatcher encapsulates the logic of giving the envelope to handlers
                    dispatcher.Dispatch();
                };
            listener.OnClose += _listeners.Remove;

            //TODO: Resolve that RabbitListener does not implement OnConnectionError
            //listener.OnConnectionError(new ReconnectOnConnectionErrorCallback(_channelFactory));

            // store the listener
            _listeners.Add(registration, listener);

            // put it on another thread so as not to block this one
            // don't continue on this thread until we've started listening
            ManualResetEvent startEvent = new ManualResetEvent(false);
            Thread listenerThread = new Thread(listener.Start);
            listenerThread.Name = string.Format("{0} on {1}:{2}{3}", exchange.QueueName, exchange.HostName, exchange.Port, exchange.VirtualHost);
            listenerThread.Start(startEvent);

            return listener;
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:30,代码来源:RabbitEnvelopeReceiver.cs

示例2: ConfigureConnectionFactory

        public override void ConfigureConnectionFactory(ConnectionFactory factory, Exchange exchange)
        {
            base.ConfigureConnectionFactory(factory, exchange);

            factory.UserName = _username;
            factory.Password = _password;
        }
开发者ID:jar349,项目名称:AMP,代码行数:7,代码来源:BasicConnectionFactory.cs

示例3: PublishJob

 protected PublishJob(IBroker broker, Exchange exchange, String routingKey)
 {
     Broker = broker;
     _exchange = exchange;
     _routingKey = routingKey;
     _stopwatch = new Stopwatch();
 }
开发者ID:pichierri,项目名称:Carrot,代码行数:7,代码来源:PublishJob.cs

示例4: ConnectTo

        public IConnection ConnectTo(Exchange exchange)
        {
            _log.Debug("Getting connection for exchange: " + exchange.ToString());
            IConnection connection = null;

            // first, see if we have a cached connection
            if (_connections.ContainsKey(exchange))
            {
                connection = _connections[exchange];

                if (!connection.IsOpen)
                {
                    _log.Info("Cached connection to RabbitMQ was closed: reconnecting");
                    connection = this.CreateConnection(exchange);
                }
            }
            else
            {
                _log.Debug("No connection to the exchange was cached: creating");
                connection = this.CreateConnection(exchange);

                // add the new connection to the cache
                _connections[exchange] = connection;
            }

            return connection;
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:27,代码来源:BaseConnectionFactory.cs

示例5: ConfigureConnectionFactory

        public override void ConfigureConnectionFactory(ConnectionFactory factory, Exchange exchange)
        {
            // try to get a certificate
            X509Certificate2 cert = _certProvider.GetCertificate();
            if (null != cert)
            {
                _log.Info("A certificate was located with subject: " + cert.Subject);
            }
            else
            {
                throw new RabbitException("Cannot connect to an exchange because no certificate was found");
            }

            base.ConfigureConnectionFactory(factory, exchange);

            // let's set the connection factory's ssl-specific settings
            // NOTE: it's absolutely required that what you set as Ssl.ServerName be
            //       what's on your rabbitmq server's certificate (its CN - common name)
            factory.AuthMechanisms = new AuthMechanismFactory[] { new ExternalMechanismFactory() };
            factory.Ssl.Certs = new X509CertificateCollection(new X509Certificate[] { cert });
            factory.Ssl.ServerName = exchange.HostName;
            factory.Ssl.Enabled = true;
            // TLS will enable more secure cipher suites to use in the exchange, encryption, and HMAC algorithms
            // used on a secure connection. Also, if the Windows OS the client runs on has the FIPS Mode security
            // policy enabled (Windows STIG), this will ensure successful connections to the Message Broker.
            factory.Ssl.Version = System.Security.Authentication.SslProtocols.Tls;
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:27,代码来源:CertificateConnectionFactory.cs

示例6: Start

	/**
	 * The Start method is called automatically by Monobehaviors,
	 * essentially becoming the constructor of the class.
	 * <p>
	 * See <a href="http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html">docs.unity3d.com</a> for more information.
	 */
    private void Start() {
        exchange = this.transform.parent.parent.GetComponentInParent<Exchange>();
        tooltip = this.transform.FindChild("Item Tooltip").gameObject;
		tooltip.SetActive(false);
        BuildTooltipText();
		clickDelta = 0.0f;
    }
开发者ID:Icohedron,项目名称:Tremaze,代码行数:13,代码来源:ShopItem.cs

示例7: BetfairClientSync

 public BetfairClientSync(Exchange exchange,
     string appKey,
     Action preNetworkRequest = null,
     WebProxy proxy = null)
 {
     client = new BetfairClient(exchange, appKey, preNetworkRequest, proxy);
 }
开发者ID:hugocorreia77,项目名称:betfairng,代码行数:7,代码来源:BetfairClientSync.cs

示例8: testWriting

 public void testWriting()
 {
     string path = @"C:\Users\Phil\Desktop\out.txt";
     Exchange ex = new Exchange();
     string response = WebInterface.queryAPI("JPM");
     Utilities.arrayify("JPM", response, ex);
     FileInterface.writeExchangeToFile(path, gl);
 }
开发者ID:pratstercs,项目名称:StockSimulator,代码行数:8,代码来源:Program.cs

示例9: GetExchangeBindings

        public static IEnumerable<ExchangeBindingSettings> GetExchangeBindings(this ReceiveSettings settings, string exchangeName)
        {
            var exchange = new Exchange(exchangeName, settings.Durable, settings.AutoDelete, settings.ExchangeType);

            var binding = new ExchangeBinding(exchange);

            yield return binding;
        }
开发者ID:phatboyg,项目名称:MassTransit,代码行数:8,代码来源:RabbitMqExchangeBindingExtensions.cs

示例10: SendResponse

 /// <inheritdoc/>
 public override void SendResponse(INextLayer nextLayer, Exchange exchange, Response response)
 {
     // A response must have the same token as the request it belongs to. If
     // the token is empty, we must use a byte array of length 0.
     if (response.Token == null)
         response.Token = exchange.CurrentRequest.Token;
     base.SendResponse(nextLayer, exchange, response);
 }
开发者ID:rlusian1,项目名称:CoAP.NET,代码行数:9,代码来源:TokenLayer.cs

示例11: RabbitListener

        public RabbitListener(IRegistration registration, Exchange exchange, IConnection connection)
        {
            _registration = registration;
            _exchange = exchange;
            _connection = connection;

            _log = LogManager.GetLogger(this.GetType());
        }
开发者ID:berico-tpinney,项目名称:AMP,代码行数:8,代码来源:RabbitListener.cs

示例12: GetExchangeBinding

        public static ExchangeBindingSettings GetExchangeBinding(this SendSettings settings, string exchangeName)
        {
            var exchange = new Exchange(exchangeName, settings.Durable, settings.AutoDelete);

            var binding = new ExchangeBinding(exchange);

            return binding;
        }
开发者ID:phatboyg,项目名称:MassTransit,代码行数:8,代码来源:RabbitMqExchangeBindingExtensions.cs

示例13: GetErrorExchangeBinding

        public static ExchangeBindingSettings GetErrorExchangeBinding(this SendSettings settings)
        {
            var exchange = new Exchange(settings.ExchangeName, true, false);

            var binding = new ExchangeBinding(exchange);

            return binding;
        }
开发者ID:nicklv,项目名称:MassTransit,代码行数:8,代码来源:RabbitMqExchangeBindingExtensions.cs

示例14: StartDataGeneration

        public void StartDataGeneration(int refreshInterval, Exchange exchange)
        {
            _refreshInterval = refreshInterval;
            this._exchange = exchange;

            //Start data fetch in another thread
            Task tskPollData = new Task(new Action(UpdateData));
            tskPollData.Start();
        }
开发者ID:togglebrain,项目名称:stock-analytics,代码行数:9,代码来源:YahooDataGenerator.cs

示例15: DeliverResponse

 /// <inheritdoc/>
 public void DeliverResponse(Exchange exchange, Response response)
 {
     if (exchange == null)
         throw ThrowHelper.ArgumentNull("exchange");
     if (response == null)
         throw ThrowHelper.ArgumentNull("response");
     if (exchange.Request == null)
         throw new ArgumentException("Request should not be empty.", "exchange");
     exchange.Request.Response = response;
 }
开发者ID:rlusian1,项目名称:CoAP.NET,代码行数:11,代码来源:ClientMessageDeliverer.cs


注:本文中的Exchange类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。