本文整理汇总了C#中IQueueManager.EnsureSubscriptionExists方法的典型用法代码示例。如果您正苦于以下问题:C# IQueueManager.EnsureSubscriptionExists方法的具体用法?C# IQueueManager.EnsureSubscriptionExists怎么用?C# IQueueManager.EnsureSubscriptionExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueueManager
的用法示例。
在下文中一共展示了IQueueManager.EnsureSubscriptionExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCompetingEventMessagePumps
private static void CreateCompetingEventMessagePumps(BusBuilderConfiguration configuration,
IQueueManager queueManager,
MessagingFactory messagingFactory,
ICollection<IMessagePump> messagePumps)
{
var eventTypes = configuration.CompetingEventHandlerTypes.SelectMany(ht => ht.GetGenericInterfacesClosing(typeof (IHandleCompetingEvent<>)))
.Select(gi => gi.GetGenericArguments().Single())
.OrderBy(t => t.FullName)
.Distinct()
.ToArray();
foreach (var eventType in eventTypes)
{
var applicationSharedSubscriptionName = String.Format("{0}", configuration.ApplicationName);
queueManager.EnsureSubscriptionExists(eventType, applicationSharedSubscriptionName);
var pump = new CompetingEventMessagePump(messagingFactory, configuration.CompetingEventBroker, eventType, applicationSharedSubscriptionName, configuration.Logger);
messagePumps.Add(pump);
}
}
示例2: CreateMulticastEventMessagePumps
private static void CreateMulticastEventMessagePumps(BusBuilderConfiguration configuration,
IQueueManager queueManager,
MessagingFactory messagingFactory,
ICollection<IMessagePump> messagePumps,
ILogger logger)
{
logger.Debug("Creating multicast event message pumps");
var eventTypes = configuration.MulticastEventHandlerTypes.SelectMany(ht => ht.GetGenericInterfacesClosing(typeof (IHandleMulticastEvent<>)))
.Select(gi => gi.GetGenericArguments().Single())
.OrderBy(t => t.FullName)
.Distinct()
.ToArray();
foreach (var eventType in eventTypes)
{
logger.Debug("Registering Message Pump for Event type {0}", eventType.Name);
var myInstanceSubscriptionName = String.Format("{0}.{1}", configuration.InstanceName, configuration.ApplicationName);
queueManager.EnsureSubscriptionExists(eventType, myInstanceSubscriptionName);
var pump = new MulticastEventMessagePump(messagingFactory, configuration.MulticastEventBroker, eventType, myInstanceSubscriptionName, configuration.Logger, configuration.DefaultBatchSize);
messagePumps.Add(pump);
}
}