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


C# IAdvancedBus.ExchangeDeclare方法代码示例

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


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

示例1: Start

        public void Start()
        {
            _bus = BusFactory.CreateAdvancedBus(ConfigurationReader.WorkflowSender);
            var senderQueue = _bus.QueueDeclare("DataPlatform.DataProvider.Sender");
            var senderExchange = _bus.ExchangeDeclare("DataPlatform.DataProvider.Sender", ExchangeType.Fanout);
            _bus.Bind(senderExchange, senderQueue, string.Empty);

            var receiverQueue = _bus.QueueDeclare("DataPlatform.DataProvider.Receiver");
            var receiverExchange = _bus.ExchangeDeclare("DataPlatform.DataProvider.Receiver", ExchangeType.Fanout);
            _bus.Bind(receiverExchange, receiverQueue, string.Empty);

            _bus.Consume(senderQueue, x => x
                .Add<SendRequestToDataProviderCommand>(
                    (message, info) => new SenderCauseFailureConsumers<SendRequestToDataProviderCommand>(message))
                .Add<GetResponseFromDataProviderCommmand>(
                    (message, info) => new SenderCauseFailureConsumers<GetResponseFromDataProviderCommmand>(message))
                .Add<CreateTransactionCommand>(
                    (message, info) => new SenderCauseFailureConsumers<CreateTransactionCommand>(message))
                .Add<ReceiveEntryPointRequest>(
                    (message, info) => new SenderCauseFailureConsumers<ReceiveEntryPointRequest>(message))
                .Add<ReturnEntryPointResponse>(
                    (message, info) => new SenderCauseFailureConsumers<ReturnEntryPointResponse>(message))
                .Add<RaisingSecurityFlagCommand>(
                    (message, info) => new SenderCauseFailureConsumers<RaisingSecurityFlagCommand>(message))
                .Add<ConfiguringDataProviderCommand>(
                    (message, info) => new SenderCauseFailureConsumers<ConfiguringDataProviderCommand>(message))
                .Add<TransformingDataProviderResponseCommand>(
                    (message, info) => new SenderCauseFailureConsumers<TransformingDataProviderResponseCommand>(message))
                .Add<ErrorInDataProviderCommand>(
                    (message, info) => new SenderCauseFailureConsumers<ErrorInDataProviderCommand>(message))
                .Add<StartingCallCommand>(
                    (message, info) => new SenderCauseFailureConsumers<StartingCallCommand>(message))
                .Add<EndingCallCommand>((message, info) => new SenderCauseFailureConsumers<EndingCallCommand>(message)));

            _bus.Consume(receiverQueue, x => x
                .Add<RequestToDataProvider>(
                    (message, info) => new ReceiverCauseFailureConsumers<RequestToDataProvider>(message))
                .Add<EntryPointReceivedRequest>(
                    (message, info) => new ReceiverCauseFailureConsumers<EntryPointReceivedRequest>(message))
                .Add<ResponseFromDataProvider>(
                    (message, info) => new ReceiverCauseFailureConsumers<ResponseFromDataProvider>(message))
                .Add<EntryPointReturnedResponse>(
                    (message, info) => new ReceiverCauseFailureConsumers<EntryPointReturnedResponse>(message))
                //.Add<BillTransactionMessage>(
                //    (message, info) => new ReceiverConsumers<BillTransactionMessage>(message))
                .Add<SecurityFlagRaised>(
                    (message, info) => new ReceiverCauseFailureConsumers<SecurityFlagRaised>(message))
                .Add<DataProviderCallEnded>(
                    (message, info) => new ReceiverCauseFailureConsumers<DataProviderCallEnded>(message))
                .Add<DataProviderCallStarted>(
                    (message, info) => new ReceiverCauseFailureConsumers<DataProviderCallStarted>(message))
                .Add<DataProviderError>(
                    (message, info) => new ReceiverCauseFailureConsumers<DataProviderError>(message))
                .Add<DataProviderResponseTransformed>(
                    (message, info) => new ReceiverCauseFailureConsumers<DataProviderResponseTransformed>(message))
                .Add<DataProviderConfigured>(
                    (message, info) => new ReceiverCauseFailureConsumers<DataProviderConfigured>(message)));

            _log.DebugFormat("Data Provider Command Processor Service Started");
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:60,代码来源:IConsumeMessagesToPutOnErrorQueues.cs

示例2: SetUp

        public void SetUp()
        {
            mockBuilder = new MockBuilder();
            advancedBus = mockBuilder.Bus.Advanced;

            exchange = advancedBus.ExchangeDeclare("my_exchange", ExchangeType.Direct, passive:true);
        }
开发者ID:siniypin,项目名称:EasyNetQ,代码行数:7,代码来源:ExchangeQueueBindingTests.cs

示例3: DeclareExchange

 public IExchange DeclareExchange(IAdvancedBus advancedBus, string exchangeName, string exchangeType)
 {
     return exchangeNames.AddOrUpdate(
         exchangeName,
         name => advancedBus.ExchangeDeclare(name, exchangeType),
         (_, exchange) => exchange);
 }
开发者ID:JohnEffo,项目名称:EasyNetQ,代码行数:7,代码来源:PublishExchangeDeclareStrategy.cs

示例4: SetUp

        public void SetUp()
        {
            mockBuilder = new MockBuilder();
            advancedBus = mockBuilder.Bus.Advanced;

            mockBuilder.NextModel.Stub(x => x.ExchangeDeclare(null, null, false, false, null))
                .IgnoreArguments()
                .WhenCalled(x =>
                    {
                        arguments = x.Arguments[4] as IDictionary;
                    });

            exchange = advancedBus.ExchangeDeclare(
                "my_exchange",
                ExchangeType.Direct,
                false,
                false,
                true,
                true,
                "my.alternate.exchange");
        }
开发者ID:hippasus,项目名称:EasyNetQ,代码行数:21,代码来源:ExchangeQueueBindingTests.cs

示例5: DeclareExchange

 public IExchange DeclareExchange(IAdvancedBus advancedBus, string exchangeName, string exchangeType)
 {
     IExchange exchange;
     if (exchanges.TryGetValue(exchangeName, out exchange))
     {
         return exchange;
     }
     semaphore.Wait();
     try
     {
         if (exchanges.TryGetValue(exchangeName, out exchange))
         {
             return exchange;
         }
         exchange = advancedBus.ExchangeDeclare(exchangeName, exchangeType);
         exchanges[exchangeName] = exchange;
         return exchange;
     }
     finally
     {
         semaphore.Release();
     }
 }
开发者ID:hippasus,项目名称:EasyNetQ,代码行数:23,代码来源:VersionedPublishExchangeDeclareStrategy.cs

示例6: Start

        public void Start()
        {
            Log.Debug("Starting Cache Worker");
            var properties = new NameValueCollection();
            properties["quartz.scheduler.instanceName"] = "RemoteServer";


            properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
            properties["quartz.threadPool.threadCount"] = "5";
            properties["quartz.threadPool.threadPriority"] = "Normal";


            properties["quartz.plugin.xml.type"] = "Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz";
            properties["quartz.plugin.xml.fileNames"] = "jobs.xml";

            ISchedulerFactory schedulerFactory = new StdSchedulerFactory(properties);
            _scheduler = schedulerFactory.GetScheduler();
            _scheduler.JobFactory = new JobFactory(_container);

            _scheduler.Start();

            _bus = _container.Resolve<IAdvancedBus>();
            var receiverQueue = _bus.QueueDeclare("DataPlatform.DataProvider.Cache.Receiver");
            var receiverExchange = _bus.ExchangeDeclare("DataPlatform.DataProvider.Cache.Receiver", ExchangeType.Fanout);
            _bus.Bind(receiverExchange, receiverQueue, string.Empty);

            _bus.Consume(receiverQueue, q => q
                .Add<ClearCacheCommand>(
                (message, info) => new ReceiverConsumers<ClearCacheCommand>(message, _container))
                .Add<RefreshCacheCommand>(
                (message, info) => new ReceiverConsumers<RefreshCacheCommand>(message, _container))
                .Add<RestartCacheDataStoreCommand>(
                (message, info) => new ReceiverConsumers<RestartCacheDataStoreCommand>(message, _container)));

            Log.Debug("Cache Worker has started");
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:36,代码来源:ICacheWorker.cs

示例7: CreatExchange

 public static IExchange CreatExchange(IAdvancedBus bus)
 {
     var environment = new Environment();
     var exchange = bus.ExchangeDeclare(environment.GetEnvironmentVariable("ExchangeName"), ExchangeType.Topic);
     return exchange;
 }
开发者ID:radicalgeek,项目名称:SampleMicroservice,代码行数:6,代码来源:ExchangeFactory.cs

示例8: Start

        public void Start()
        {
            _log.DebugFormat("Data Provider Command Processor Service being fired up...");

            var container = new WindsorContainer().Install(
                new WindsorInstaller(),
                new RepositoryInstaller(),
                new ConsumerInstaller(),
                new BusInstaller());

            _bus = container.Resolve<IAdvancedBus>();
            var senderQueue = _bus.QueueDeclare("DataPlatform.DataProvider.Sender");
            var senderExchange = _bus.ExchangeDeclare("DataPlatform.DataProvider.Sender", ExchangeType.Fanout);
            _bus.Bind(senderExchange, senderQueue, string.Empty);

            var receiverQueue = _bus.QueueDeclare("DataPlatform.DataProvider.Receiver");
            var receiverExchange = _bus.ExchangeDeclare("DataPlatform.DataProvider.Receiver", ExchangeType.Fanout);
            _bus.Bind(receiverExchange, receiverQueue, string.Empty);

            _bus.Consume(senderQueue, q => q
                .Add<SendRequestToDataProviderCommand>(
                    (message, info) => new SenderConsumers<SendRequestToDataProviderCommand>(message, container))
                .Add<GetResponseFromDataProviderCommmand>(
                    (message, info) => new SenderConsumers<GetResponseFromDataProviderCommmand>(message, container))
                .Add<CreateTransactionCommand>(
                    (message, info) => new SenderConsumers<CreateTransactionCommand>(message, container))
                .Add<ReceiveEntryPointRequest>(
                    (message, info) => new SenderConsumers<ReceiveEntryPointRequest>(message, container))
                .Add<ReturnEntryPointResponse>(
                    (message, info) => new SenderConsumers<ReturnEntryPointResponse>(message, container))
                .Add<RaisingSecurityFlagCommand>(
                    (message, info) => new SenderConsumers<RaisingSecurityFlagCommand>(message, container))
                .Add<ConfiguringDataProviderCommand>(
                    (message, info) => new SenderConsumers<ConfiguringDataProviderCommand>(message, container))
                .Add<TransformingDataProviderResponseCommand>(
                    (message, info) => new SenderConsumers<TransformingDataProviderResponseCommand>(message, container))
                .Add<ErrorInDataProviderCommand>(
                    (message, info) => new SenderConsumers<ErrorInDataProviderCommand>(message, container))
                .Add<StartingCallCommand>(
                    (message, info) => new SenderConsumers<StartingCallCommand>(message, container))
                .Add<EndingCallCommand>((message, info) => new SenderConsumers<EndingCallCommand>(message, container)));

            _bus.Consume(receiverQueue, q => q
                .Add<RequestToDataProvider>(
                    (message, info) => new ReceiverConsumers<RequestToDataProvider>(message, container))
                .Add<EntryPointReceivedRequest>(
                    (message, info) => new ReceiverConsumers<EntryPointReceivedRequest>(message, container))
                .Add<ResponseFromDataProvider>(
                    (message, info) => new ReceiverConsumers<ResponseFromDataProvider>(message, container))
                .Add<EntryPointReturnedResponse>(
                    (message, info) => new ReceiverConsumers<EntryPointReturnedResponse>(message, container))
                .Add<BillTransactionMessage>(
                    (message, info) => new ReceiverConsumers<BillTransactionMessage>(message, container))
                .Add<SecurityFlagRaised>(
                    (message, info) => new ReceiverConsumers<SecurityFlagRaised>(message, container))
                .Add<DataProviderCallEnded>(
                    (message, info) => new ReceiverConsumers<DataProviderCallEnded>(message, container))
                .Add<DataProviderCallStarted>(
                    (message, info) => new ReceiverConsumers<DataProviderCallStarted>(message, container))
                .Add<DataProviderError>(
                    (message, info) => new ReceiverConsumers<DataProviderError>(message, container))
                .Add<DataProviderResponseTransformed>(
                    (message, info) => new ReceiverConsumers<DataProviderResponseTransformed>(message, container))
                .Add<DataProviderConfigured>(
                    (message, info) => new ReceiverConsumers<DataProviderConfigured>(message, container)));

            var apiReceiverQueue = _bus.QueueDeclare("DataPlatform.Api");
            var apiReceiverExchange = _bus.ExchangeDeclare("DataPlatform.Api", ExchangeType.Fanout);
            _bus.Bind(apiReceiverExchange, apiReceiverQueue, string.Empty);

            _bus.Consume(apiReceiverQueue,
                q => q.Add<RequestMetadataMessage>((message, info) => new ReceiverConsumers<RequestMetadataMessage>(message, container)));

            _log.DebugFormat("Data Provider Command Processor Service Started");
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:75,代码来源:DataProviderWorker.cs


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