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


C# IModel.ExchangeBind方法代码示例

本文整理汇总了C#中IModel.ExchangeBind方法的典型用法代码示例。如果您正苦于以下问题:C# IModel.ExchangeBind方法的具体用法?C# IModel.ExchangeBind怎么用?C# IModel.ExchangeBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IModel的用法示例。


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

示例1: SetupSubscription

 public void SetupSubscription(IModel channel, Type type, string subscriberName)
 {
     if (type == typeof(IEvent))
     {
         // Make handlers for IEvent handle all events whether they extend IEvent or not
         type = typeof(object);
     }
     SetupTypeSubscriptions(channel, type);
     channel.ExchangeBind(subscriberName, ExchangeName(type), string.Empty);
 }
开发者ID:laxmanrapolu,项目名称:NserviceBusDemo,代码行数:10,代码来源:ConventionalRoutingTopology.cs

示例2: SetupTypeSubscriptions

        void SetupTypeSubscriptions(IModel channel, Type type)
        {
            if (type == typeof(Object) || IsTypeTopologyKnownConfigured(type))
            {
                return;
            }
            {
                var typeToProcess = type;
                CreateExchange(channel, ExchangeName(typeToProcess));
                var baseType = typeToProcess.BaseType;
                while (baseType != null)
                {
                    CreateExchange(channel, ExchangeName(baseType));
                    channel.ExchangeBind(ExchangeName(baseType), ExchangeName(typeToProcess), string.Empty);
                    typeToProcess = baseType;
                    baseType = typeToProcess.BaseType;
                }
            }

            foreach (var exchangeName in type.GetInterfaces().Select(ExchangeName))
            {
                CreateExchange(channel, exchangeName);
                channel.ExchangeBind(exchangeName, ExchangeName(type), string.Empty);

            }
            MarkTypeConfigured(type);
        }
开发者ID:laxmanrapolu,项目名称:NserviceBusDemo,代码行数:27,代码来源:ConventionalRoutingTopology.cs

示例3: EstablishSubscription

        void EstablishSubscription(IModel model, Type subscription)
        {
            var eventName = GetEventName(subscription);
            var exchange = UsingOneExchangePerMessageTypeRouting ? eventName : ExchangeName;
            var routingKey = UsingOneExchangePerMessageTypeRouting ? "" : eventName;
            var inputAddress = InputQueueAddress.TrimStart('@');

            if (UsingOneExchangePerMessageTypeRouting)
            {
                log.Debug("Declaring fanout exchange for: {0}", exchange);
                model.ExchangeDeclare(exchange, "fanout", true, false, null);
            }

            log.Info("Subscribing {0} to {1}", inputAddress, eventName);
            if (InputQueueAddressIsExchange)
            {
                model.ExchangeBind(inputAddress, exchange, routingKey);
            }
            else
            {
                model.QueueBind(inputAddress, exchange, routingKey);
            }
        }
开发者ID:JanRou,项目名称:Rebus,代码行数:23,代码来源:RabbitMqMessageQueue.cs

示例4: StartConnection

        private void StartConnection()
        {
            try
            {
                var factory = GetConnectionFac();
                factory.UseBackgroundThreadsForIO = true;
                _Connection = factory.CreateConnection();
                _Connection.ConnectionShutdown += ShutdownAmqp;

                try { _Model = _Connection.CreateModel(); }
                catch (Exception e)
                {
                    ErrorHandler.Error("could not create model", e);
                }
            }
            catch (Exception e)
            {
                ErrorHandler.Error("could not connect to Rabbit instance", e);
            }

            if (_Model != null)
            {
                _Model.ExchangeDeclare(this.ExchangeProperties.Name, this.ExchangeProperties.ExchangeType, this.ExchangeProperties.Durable, this.ExchangeProperties.AutoDelete, null);

                foreach (ExchangeBinding exchangeBinding in this.ExchangeProperties.Bindings)
                {
                    _Model.ExchangeBind(exchangeBinding.Destination, this.ExchangeProperties.Name, exchangeBinding.Topic);
                }

                _Model.ModelShutdown += OnModelShutdown;
                this.Debug("apqp connection opened");
            }
        }
开发者ID:TarheadStudio,项目名称:log4net.RabbitMQ,代码行数:33,代码来源:RabbitMQAppenderBase.cs

示例5: DeclareBindings

        /// <summary>Declare the bindings.</summary>
        /// <param name="channel">The channel.</param>
        /// <param name="bindings">The bindings.</param>
        private void DeclareBindings(IModel channel, params Binding[] bindings)
        {
            foreach (var binding in bindings)
            {
                Logger.Debug(m => m("Binding destination [{0} ({1})] to exchange [{2}] with routing key [{3}]", binding.Destination, binding.BindingDestinationType, binding.Exchange, binding.RoutingKey));

                if (binding.IsDestinationQueue())
                {
                    if (!this.IsDeclaringImplicitQueueBinding(binding))
                    {
                        channel.QueueBind(binding.Destination, binding.Exchange, binding.RoutingKey, binding.Arguments);
                    }
                }
                else
                {
                    channel.ExchangeBind(binding.Destination, binding.Exchange, binding.RoutingKey, binding.Arguments);
                }
            }
        }
开发者ID:yonglehou,项目名称:spring-net-amqp,代码行数:22,代码来源:RabbitAdmin.cs


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