/// <summary> /// Subscribes to a message topic at the IMessagingInfrastructure stored in Messaging. The subscription is only done in case /// the routeFilterPattern matches any SubscriptionPatterns. /// </summary> /// <param name="routeFilterPattern">The message topic pattern used for subscription.</param> /// <param name="handler">Action being called in case a message with matching topic arrives.</param> /// <returns>A subscriptionId as object or null in case no subscription where done.</returns> internal MessageRoutingSubscription Subscribe(string routeFilterPattern, Action <Message> handler) { var patterns = DetermineSubscriptionPatterns(routeFilterPattern).ToArray(); if (patterns.Length == 0) { return(null); } var subscription = new MessageRoutingSubscription(Messaging); subscription.Subscribe(patterns, handler); return(subscription); }
/// <summary> /// Subcribes to a message topic at the IMessagingInfrastructure stored in Messaging. The subscription is only done in case /// the routeFilterPattern matches any SubscriptionPatterns. /// </summary> /// <param name="routeFilterPattern">The message topic pattern used for subscription.</param> /// <returns>A subscriptionId as object or null in case no subscription where done.</returns> internal MessageRoutingSubscription Subscribe <TMessageHandler>(string routeFilterPattern) where TMessageHandler : IMessageHandler { var patterns = DetermineSubscriptionPatterns(routeFilterPattern).ToArray(); if (patterns.Length == 0) { return(null); } var subscription = new MessageRoutingSubscription(Messaging); subscription.Subscribe <TMessageHandler>(patterns); return(subscription); }