/// <summary> /// Subscribes to recieve published messages of type T. /// This method is only necessary if you turned off auto-subscribe /// </summary> /// <param name="type">The type to subscribe</param> public void Subscribe(Type type) { Guard.ArgumentNotNull(type, "type"); logger.Info("Subscribe={0}", type.FullName); subscribedTypes.Add(type); BusHelper.SubscribeOrUnsubscribeType((s) => { logger.Info(s); }, type, config, receiver.CreateSubscription); }
/// <summary> /// Unsubscribes from receiving published messages of the specified type. /// </summary> /// <param name="type">The type of message to unsubscribe from</param> public void Unsubscribe(Type type) { Guard.ArgumentNotNull(type, "type"); logger.Info("Unsubscribe={0}", type.FullName); if (subscribedTypes.Contains(type)) { subscribedTypes.Remove(type); } BusHelper.SubscribeOrUnsubscribeType((s) => { logger.Info(s); }, type, config, receiver.CancelSubscription); }
/// <summary> /// Subscribes to recieve published messages of type T. /// This method is only necessary if you turned off auto-subscribe /// </summary> /// <param name="type">The type to subscribe</param> public void Subscribe(Type type) { Guard.ArgumentNotNull(type, "type"); BusHelper.SubscribeOrUnsubscribeType((s) => { Debug.WriteLine(s); }, type, config, (info) => { var filter = new SqlFilter(string.Format(AzureSenderReceiverBase.TYPE_HEADER_NAME + " = '{0}'", info.MessageType.FullName.Replace('.', '_'))); var desc = new SubscriptionDescription(config.TopicName, info.SubscriptionName); _endpointMap[desc] = info; CreateSubscription(desc, filter); //TODO determine if we should and can call CreateSubscription on the receiver. //receiver.CreateSubscription(info); }); }