本文整理汇总了C#中IServiceBus.SubscribeConsumer方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceBus.SubscribeConsumer方法的具体用法?C# IServiceBus.SubscribeConsumer怎么用?C# IServiceBus.SubscribeConsumer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceBus
的用法示例。
在下文中一共展示了IServiceBus.SubscribeConsumer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: installation_of_infrastructure_objects
public void installation_of_infrastructure_objects()
{
Logger.Info("Installing stuff");
LocalBus = ServiceBusFactory.New(x => x.ReceiveFrom("loopback://localhost/mt_client"));
var eventPublisher = new EventPublisher(LocalBus);
var inMemoryEventStore = new InMemoryEventStore(eventPublisher);
var aggregateFactory = new AggregateFactory();
var simpleEventRepository = new SimpleEventRepository(inMemoryEventStore, aggregateFactory);
LocalBus.SubscribeConsumer(() => new MyEventConsumer(_received));
LocalBus.SubscribeConsumer(() => new CreateBatchCommandHandler(simpleEventRepository));
LocalBus.SubscribeConsumer(() => new RequestSeparateDocumentsCommandHandler(simpleEventRepository));
LocalBus.SubscribeConsumer(() => new RequestClassifyDocumentsCommandHandler(simpleEventRepository));
//LocalBus.WriteIntrospectionToFile("d:/ws/programmering/quantum/quantum.tests/localbuslog.txt");
//PipelineViewer.Trace(LocalBus.InboundPipeline);
//PipelineViewer.Trace(LocalBus.OutboundPipeline);
//Prep the event store for this aggregate (could've published a CreateBatch command, but then we would be testing that as well)
simpleEventRepository.Save(new Batch(_aggregateId), Guid.NewGuid(), null);
}
示例2: Start
public void Start(IServiceBus bus)
{
_bus = bus;
_bus.SubscribeConsumer<PasswordUpdater>();
Console.WriteLine(new string('-', 20));
Console.WriteLine("New Password Client");
Console.WriteLine("What would you like to set your new password to?");
Console.Write("New Password:");
string newPassword = Console.ReadLine();
Console.WriteLine(new string('-', 20));
var message = new RequestPasswordUpdate(newPassword);
_bus.Publish(message);
Console.WriteLine("Waiting For Reply with CorrelationId '{0}'", message.CorrelationId);
Console.WriteLine(new string('-', 20));
}
示例3: Start
/// <summary>
/// Called when the service is being started, which is after the service bus has been started.
/// </summary>
/// <param name="bus">The service bus</param>
public void Start(IServiceBus bus)
{
_scheduler = _schedulerFactory();
bus.SubscribeConsumer(() => new TimeoutHandlers(_scheduler));
}