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


C# IServiceBus类代码示例

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


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

        public bool Start(HostControl hostControl)
        {
            var container = new Container(cfg => cfg.Scan(scan =>
                {
                    scan.TheCallingAssembly();
                    scan.AssembliesFromApplicationBaseDirectory();
                    scan.AddAllTypesOf(typeof (IConsumer));
                }));

            try
            {
                _Bus = ServiceBusFactory.New(sbc =>
                    {
                        sbc.UseRabbitMq();
                        sbc.ReceiveFrom(ConfigurationManager.AppSettings["RabbitMQEndPoint"]);
                        sbc.Subscribe(x => x.LoadFrom(container));
                        sbc.Validate();
                    });

                container.Inject(_Bus);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return false;
            }
            return true;
        }
开发者ID:RendaniTshinakaho,项目名称:Cuttlefish,代码行数:28,代码来源:ProjectionService.cs


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