public async Task StartDispatchers(IEnumerable<KeyValuePair<Type, Func<object, Task>>> typeHandlerMaps) { foreach (var typeHandlerMap in typeHandlerMaps) { string queueIdentifier = _endpointNamingPolicy.GetQueueName(typeHandlerMap.Key); MessageReceiver receiver = await _queueManager.GetReceiver(queueIdentifier); Func<object, Task> processor = typeHandlerMap.Value; var dispatcher = new MessageDispatcher(_logger, receiver, processor, _brokeredMessageFactory, typeHandlerMap.Key, _maxConcurrentReceiverCallsSetting); _messageDispatchers.Add(dispatcher); } }
public async Task StartDispatchers(IEnumerable<KeyValuePair<TopicSubscriptionIdentifier, Func<object, Task>>> typeHandlerMaps) { foreach (var typeHandlerMap in typeHandlerMaps) { string topicIdentifier = _endpointNamingPolicy.GetTopicName(typeHandlerMap.Key.MessageType); string subscriptionIdentifier = _endpointNamingPolicy.GetSubscriptionName(typeHandlerMap.Key.MessageType, typeHandlerMap.Key.SubscriberType); MessageReceiver receiver = await _subscriptionManager.GetReceiver(subscriptionIdentifier, topicIdentifier); Func<object, Task> processor = typeHandlerMap.Value; var dispatcher = new MessageDispatcher(_logger, receiver, processor, _brokeredMessageFactory, typeHandlerMap.Key.MessageType, _maxConcurrentReceiverCallsSetting); _messageDispatchers.Add(dispatcher); } }