• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IServiceBus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SubscriptionClient

	    public SubscriptionClient(IServiceBus bus, SubscriptionRouter router, Uri subscriptionServiceUri,
		                          TimeSpan startTimeout)
		{
			_bus = bus;
			_router = router;
			_subscriptionServiceUri = subscriptionServiceUri;
			_startTimeout = startTimeout;
			_network = router.Network;

			if (_log.IsDebugEnabled)
				_log.DebugFormat("Starting SubscriptionClient using {0}", subscriptionServiceUri);

			VerifyClientAndServiceNotOnSameEndpoint(bus);

			_ready.Reset();

			var consumerInstance = new SubscriptionMessageConsumer(_router, _network);

			_unsubscribeAction = _bus.ControlBus.SubscribeInstance(consumerInstance);
		    _unsubscribeAction += _bus.ControlBus.SubscribeContextHandler<SubscriptionRefresh>(Consume);

		    _subscriptionEndpoint = _bus.GetEndpoint(subscriptionServiceUri);
		    _producer = new SubscriptionServiceMessageProducer(router, _subscriptionEndpoint);

			WaitForSubscriptionServiceResponse();
		}
开发者ID:vinayreddym,项目名称:MassTransit,代码行数:26,代码来源:SubscriptionClient.cs


示例2: ThreadPoolConsumerPool

		public ThreadPoolConsumerPool(IServiceBus bus, IObjectBuilder objectBuilder, Pipe eventAggregator, TimeSpan receiveTimeout)
		{
			_objectBuilder = objectBuilder;
			_receiveTimeout = receiveTimeout;
			_eventAggregator = eventAggregator;
			_bus = bus;
		}
开发者ID:KevM,项目名称:MassTransit,代码行数:7,代码来源:ThreadPoolConsumerPool.cs


示例3: Initialize

        public void Initialize(IServiceBus bus)
        {
            if (ServiceBusConfiguration.ServiceBusSection == null || ServiceBusConfiguration.ServiceBusSection.ForwardingRoutes == null)
            {
                return;
            }

            var factory = new MessageRouteSpecificationFactory();

            foreach (MessageRouteElement mapElement in ServiceBusConfiguration.ServiceBusSection.ForwardingRoutes)
            {
                var map = messageRoutes.Find(mapElement.Uri);

                if (map == null)
                {
                    map = new MessageRoute(bus.Configuration.QueueManager.GetQueue(mapElement.Uri));

                    messageRoutes.Add(map);
                }

                foreach (SpecificationElement specificationElement in mapElement)
                {
                    map.AddSpecification(factory.Create(specificationElement.Name, specificationElement.Value));
                }
            }
        }
开发者ID:nnyamhon,项目名称:shuttle-esb,代码行数:26,代码来源:DefaultForwardingRouteProvider.cs


示例4: SubscriptionRouterService

		public SubscriptionRouterService(IServiceBus bus, string network)
		{
			_peerUri = bus.ControlBus.Endpoint.Address.Uri;

			_network = network;

			_peerId = CombGuid.Generate();

			_observers = new List<SubscriptionObserver>();
			_listeners = new List<BusSubscriptionEventListener>();

			_unregister = () => true;

			_peerUri = bus.ControlBus.Endpoint.Address.Uri;

			var connector = new BusSubscriptionConnector(bus);

			_peerCache = ActorFactory.Create<PeerCache>(x =>
				{
					x.ConstructedBy((fiber, scheduler, inbox) =>
					                new PeerCache(fiber, scheduler, connector, _peerId, _peerUri));
					x.UseSharedScheduler();
					x.HandleOnPoolFiber();
				})
				.GetActor();
		}
开发者ID:vinayreddym,项目名称:MassTransit,代码行数:26,代码来源:SubscriptionRouterService.cs


示例5: MulticastSubscriptionClient

		public MulticastSubscriptionClient(IServiceBus subscriptionBus, Uri uri, string networkKey)
		{
			_subscriptionBus = subscriptionBus;
			_uri = uri;

			_networkKey = networkKey;
		}
开发者ID:jimitndiaye,项目名称:MassTransit,代码行数:7,代码来源:MulticastSubscriptionClient.cs


示例6: TaskMonitoringSource

 public TaskMonitoringSource(HealthMonitoringSettings settings, ILogger logger, IServiceBus serviceBus, ISubscriptionRepository repository)
 {
     _settings = settings;
     _logger = logger;
     _serviceBus = serviceBus;
     _repository = repository;
 }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:7,代码来源:TaskMonitoringSource.cs


示例7: SetUp

        public void SetUp()
        {
            // Need to do something about this.  Little ridiculous
            FubuTransport.SetupForInMemoryTesting();
            TestMessageRecorder.Clear();
            MessageHistory.ClearAll();
            InMemoryQueueManager.ClearAll();

            runtime = FubuTransport.For<DelayedRegistry>().StructureMap(new Container())
                                       .Bootstrap();

            theServiceBus = runtime.Factory.Get<IServiceBus>();

            theClock = runtime.Factory.Get<ISystemTime>().As<SettableClock>();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:25,代码来源:Full_end_to_end_delayed_message_processing_with_in_memory_queues.cs


示例8: LoginController

 public LoginController(IUserRepository userRepository, IServiceBus bus, ITranslationService translationService, IPasswordPolicy passwordPolicy)
 {
     _userRepository = userRepository;
     _bus = bus;
     _translationService = translationService;
     _passwordPolicy = passwordPolicy;
 }
开发者ID:robinvanderknaap,项目名称:SkaeleArchitecture,代码行数:7,代码来源:LoginController.cs


示例9: CreateCustomerViewModel

 public CreateCustomerViewModel(IServiceBus bus, IEventAggregator eventAggregator)
 {
     _Bus = bus;
     _EventAggregator = eventAggregator;
     Command = new CreateNewCustomer(CombGuid.Generate(),
         "unknown", "unknown", "unknown", "unknown", "unknown", "305533333");
 }
开发者ID:ValdimarThor,项目名称:Documently,代码行数:7,代码来源:CreateCustomerViewModel.cs


示例10: SubscriptionRouterService

        public SubscriptionRouterService(IServiceBus bus, SubscriptionRepository repository, string network)
        {
            _peerUri = bus.ControlBus.Endpoint.Address.Uri;

            _repository = repository;
            _network = network;

            _peerId = NewId.NextGuid();

            _observers = new List<SubscriptionObserver>();
            _listeners = new List<BusSubscriptionEventListener>();

            _unregister = () => true;

            _peerUri = bus.ControlBus.Endpoint.Address.Uri;

            var connector = new BusSubscriptionConnector(bus);

            _peerCache = ActorFactory.Create<PeerCache>(x =>
                {
                    x.ConstructedBy((fiber, scheduler, inbox) =>
                                    new PeerCache(connector, _peerId, _peerUri, repository));
                    x.UseSharedScheduler();
                    x.HandleOnPoolFiber();
                })
                .GetActor();

            // at this point, existing subscriptions need to be loaded...

            _repository.Load(this);
        }
开发者ID:jweber,项目名称:MassTransit,代码行数:31,代码来源:SubscriptionRouterService.cs


示例11: SendMessagePipeline

        public SendMessagePipeline(IServiceBus bus)
            : base(bus)
        {
            RegisterStage("Send")
                .WithEvent<OnPrepareMessage>()
                .WithEvent<OnAfterPrepareMessage>()
                .WithEvent<OnFindRouteForMessage>()
                .WithEvent<OnAfterFindRouteForMessage>()
                .WithEvent<OnSerializeMessage>()
                .WithEvent<OnAfterSerializeMessage>()
                .WithEvent<OnEncryptMessage>()
                .WithEvent<OnAfterEncryptMessage>()
                .WithEvent<OnCompressMessage>()
                .WithEvent<OnAfterCompressMessage>()
                .WithEvent<OnSerializeTransportMessage>()
                .WithEvent<OnAfterSerializeTransportMessage>()
                .WithEvent<OnSendMessage>()
                .WithEvent<OnAfterSendMessage>();

            RegisterObserver(new PrepareMessageObserver());
            RegisterObserver(new FindMessageRouteObserver());
            RegisterObserver(new SerializeMessageObserver());
            RegisterObserver(new SerializeTransportMessageObserver());
            RegisterObserver(new CompressMessageObserver());
            RegisterObserver(new EncryptMessageObserver());
            RegisterObserver(new SendMessageObserver());
        }
开发者ID:jessezhao,项目名称:shuttle-esb,代码行数:27,代码来源:SendMessagePipeline.cs


示例12: TodoModule

        public TodoModule(IAppSettings appSettings, ITodoService todoService, IServiceBus bus)
        {
            _todoService = todoService;
            _bus = bus;

            Post["/todo"] = _ =>
            {
                var slashCommand = this.Bind<SlashCommand>();
                if (slashCommand == null ||
                    slashCommand.command.Missing())
                {
                    Log.Info("Rejected an incoming slash command (unable to parse request body).");
                    return HttpStatusCode.BadRequest.WithReason("Unable to parse slash command.");
                }
                if (!appSettings.Get("todo:slackSlashCommandToken").Equals(slashCommand.token))
                {
                    Log.Info("Blocked an unauthorized slash command.");
                    return HttpStatusCode.Unauthorized.WithReason("Missing or invalid token.");
                }
                if (!slashCommand.command.Equals("/todo", StringComparison.InvariantCultureIgnoreCase))
                {
                    Log.Info("Rejected an incoming slash command ({0} is not handled by this module).", slashCommand.command);
                    return HttpStatusCode.BadRequest.WithReason("Unsupported slash command.");
                }

                var responseText = HandleTodo(slashCommand);
                if (responseText.Missing())
                {
                    return HttpStatusCode.OK;
                }
                return responseText;
            };
        }
开发者ID:rapidexpert,项目名称:SlackCommander,代码行数:33,代码来源:TodoModule.cs


示例13: DistributedHashTable

        public DistributedHashTable(
            string database,
            Uri url,
            IEndpointRouter endpointRouter,
            IServiceBus bus,
            Node metadata)
        {
            Url = url;
            this.endpointRouter = endpointRouter;
            this.bus = bus;
            Metadata = metadata;

            if (Metadata != null) // sole node in the network, probably
            {
                Metadata.ExecuteSync(uri =>
                {
                    ServiceUtil.Execute<IDistributedHashTableMetaDataProvider>(uri, srv =>
                    {
                        failOver = srv.GetNodeByUri(url);
                    });
                });
            }
            try
            {
                hashTable = new PersistentHashTable(database);
                hashTable.Initialize();
            }
            catch (Exception)
            {
                hashTable.Dispose();
                throw;
            }
        }
开发者ID:endeavour,项目名称:rhino-tools,代码行数:33,代码来源:DistributedHashTable.cs


示例14: WebSocketHandler

 public WebSocketHandler(IServiceBus bus, WebSocket ws, IEventSerializator serializer, ILogger log)
 {
     _ws = ws;
     _queue = bus;
     _log = log;
     _serializer = serializer;
 }
开发者ID:Chelaris182,项目名称:WebSocketListener,代码行数:7,代码来源:WebSocketHandler.cs


示例15: Promoted

 public void Promoted(IServiceBus bus)
 {
     if (_scheduler != null && !_scheduler.IsShutdown) _scheduler.Shutdown();
     _scheduler = _schedulerFactory();
     _scheduler.JobFactory = new ServiceBusJobFactory(bus);
     _scheduler.Start();
 }
开发者ID:fivepmtechnology,项目名称:MassTransit-Cluster,代码行数:7,代码来源:SchedulerService.cs


示例16: RegisterHandlers

        public static void RegisterHandlers(IReadOnlyStore readOnlyStore, IServiceBus serviceBus)
        {
            _serviceBus = serviceBus;

            RegisterCommandHandler(new ProductListCommandHandlers());
            RegisterEventHandler(new ProductListEventHandlers(readOnlyStore));
        }
开发者ID:ymotton,项目名称:CQRS-Sample1,代码行数:7,代码来源:ProcessHandler.cs


示例17: GetDecoratedBus

		public override IServiceBus GetDecoratedBus(IServiceBus bus)
		{
			if (_realBus == bus)
				return _bus;

			return base.GetDecoratedBus(bus);
		}
开发者ID:rajwilkhu,项目名称:MassTransit,代码行数:7,代码来源:BusTestScenarioImpl.cs


示例18: Initialize

        public void Initialize(IServiceBus serviceBus)
        {
            Guard.AgainstNull(serviceBus, "serviceBus");

            AddAssertion("BeforeDequeueStream", Assertion);
            AddAssertion("AfterDequeueStream", Assertion);
            AddAssertion("AfterMessageDeserialization", Assertion);
            AddAssertion("BeforeEnqueueStream", Assertion);
            AddAssertion("AfterEnqueueStream", Assertion);
            AddAssertion("BeforeHandleMessage", Assertion);
            AddAssertion("AfterHandleMessage", Assertion);
            AddAssertion("BeforeRemoveMessage", Assertion);
            AddAssertion("AfterRemoveMessage", Assertion);

            serviceBus.Events.BeforeDequeueStream += (sender, e) => ThrowException("BeforeDequeueStream");
            serviceBus.Events.AfterDequeueStream += (sender, e) => ThrowException("AfterDequeueStream");
            serviceBus.Events.AfterMessageDeserialization += (sender, e) => ThrowException("AfterMessageDeserialization");
            serviceBus.Events.BeforeEnqueueStream += (sender, e) => ThrowException("BeforeEnqueueStream");
            serviceBus.Events.AfterEnqueueStream += (sender, e) => ThrowException("AfterEnqueueStream");
            serviceBus.Events.BeforeHandleMessage += (sender, e) => ThrowException("BeforeHandleMessage");
            serviceBus.Events.AfterHandleMessage += (sender, e) => ThrowException("AfterHandleMessage");
            serviceBus.Events.BeforeRemoveMessage += (sender, e) => ThrowException("BeforeRemoveMessage");
            serviceBus.Events.AfterRemoveMessage += (sender, e) => ThrowException("AfterRemoveMessage");

            serviceBus.Events.PipelineReleased += PipelineReleased;
        }
开发者ID:nnyamhon,项目名称:shuttle-esb,代码行数:26,代码来源:ReceivePipelineExceptionModule.cs


示例19: SimpleEventStore

 public SimpleEventStore(IStoreSettings<IDbConnection> settings, IServiceBus serviceBus, ISerialize serializer, ISnapshotStore snapshotStore)
 {
     _settings = settings;
     _serviceBus = serviceBus;
     _serializer = serializer;
     _snapshotStore = snapshotStore;
 }
开发者ID:nullkiller,项目名称:GetEventStoreSample,代码行数:7,代码来源:SimpleEventStore.cs


示例20: Start

        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceBus">The service bus on which commands are received</param>
        /// <param name="controlBus">The control bus for the synchronization messages between nodes</param>
        public void Start(IServiceBus serviceBus, IServiceBus controlBus)
        {
            _serviceBus = serviceBus;
            _controlBus = controlBus;

            _nodeState.ChangeTo<FollowerBehavior>();
        }
开发者ID:phatboyg,项目名称:MassTransit-Steward,代码行数:12,代码来源:ServiceNode.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IServiceClient类代码示例发布时间:2022-05-24
下一篇:
C# IServiceBase类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap