本文整理汇总了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();
}
示例2: ThreadPoolConsumerPool
public ThreadPoolConsumerPool(IServiceBus bus, IObjectBuilder objectBuilder, Pipe eventAggregator, TimeSpan receiveTimeout)
{
_objectBuilder = objectBuilder;
_receiveTimeout = receiveTimeout;
_eventAggregator = eventAggregator;
_bus = bus;
}
示例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));
}
}
}
示例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();
}
示例5: MulticastSubscriptionClient
public MulticastSubscriptionClient(IServiceBus subscriptionBus, Uri uri, string networkKey)
{
_subscriptionBus = subscriptionBus;
_uri = uri;
_networkKey = networkKey;
}
示例6: TaskMonitoringSource
public TaskMonitoringSource(HealthMonitoringSettings settings, ILogger logger, IServiceBus serviceBus, ISubscriptionRepository repository)
{
_settings = settings;
_logger = logger;
_serviceBus = serviceBus;
_repository = repository;
}
示例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;
}
示例9: CreateCustomerViewModel
public CreateCustomerViewModel(IServiceBus bus, IEventAggregator eventAggregator)
{
_Bus = bus;
_EventAggregator = eventAggregator;
Command = new CreateNewCustomer(CombGuid.Generate(),
"unknown", "unknown", "unknown", "unknown", "unknown", "305533333");
}
示例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);
}
示例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());
}
示例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;
};
}
示例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;
}
}
示例14: WebSocketHandler
public WebSocketHandler(IServiceBus bus, WebSocket ws, IEventSerializator serializer, ILogger log)
{
_ws = ws;
_queue = bus;
_log = log;
_serializer = serializer;
}
示例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;
}