本文整理汇总了C#中IServiceBus.SubscribeHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceBus.SubscribeHandler方法的具体用法?C# IServiceBus.SubscribeHandler怎么用?C# IServiceBus.SubscribeHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceBus
的用法示例。
在下文中一共展示了IServiceBus.SubscribeHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SequencingViewModel
public SequencingViewModel(IContestDao contestDao, IServiceBus eventBus)
{
_contestDao = contestDao;
_sequence = new ObservableCollection<SequencingItem>();
this.Sequence = new ReadOnlyObservableCollection<SequencingItem>(_sequence);
eventBus.SubscribeHandler<SequencingChanged>(async (e) =>
{
await LoadData().ConfigureAwait(false);
});
this.RefreshDataCommand = DelegateCommand.FromAsyncHandler(LoadData);
}
示例2: Configuration
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
app.UseWebApi(config);
app.MapSignalR();
Bus = ServiceBusFactory.New(cfg =>
{
cfg.DisablePerformanceCounters();
cfg.ReceiveFrom("rabbitmq://localhost/qqqq-web");
cfg.UseRabbitMq(cf =>
{
cf.ConfigureHost(new Uri("rabbitmq://localhost/qqqq-web"), hc =>
{
hc.SetUsername("petcar");
hc.SetPassword("?!Krone2009");
});
});
});
HubEventNotifier notifier = new HubEventNotifier();
Bus.SubscribeHandler<ClientNotification>(notifier.Handle);
Bus.SubscribeHandler<ItemAddedEvent>(notifier.Handle);
Bus.SubscribeHandler<ItemUpdatedEvent>(notifier.Handle);
Bus.SubscribeHandler<ItemDeletedEvent>(notifier.Handle);
}
示例3: SampleCommandHandler
public SampleCommandHandler(IServiceBus serviceBus)
{
_serviceBus = serviceBus;
_serviceBus.SubscribeHandler<SampleCommand>(Handle);
}