/// <summary> /// Создать подписку в шине. /// </summary> /// <param name="subscription">Подписка.</param> void IServiceBusManager.CreateSubscription(ServiceBusSubscription subscription) { TransportType transportType; EnumCaption.TryGetValueFor(subscription.SendBy, out transportType); bool callback = subscription.Callback ?? false; _subscriptionsManager.SubscribeOrUpdate(subscription.ClientID, subscription.MessageTypeID, callback, transportType, subscription.ExpiryDate, subscription.ID); }
/// <summary> /// Получить все подписки в шине. /// </summary> /// <param name="clientId">Идентификатор клиента.</param> /// <returns>Все подписки клиента.</returns> IEnumerable <ServiceBusSubscription> IServiceBusManager.GetSubscriptions(string clientId) { IEnumerable <Subscription> subscriptions = _subscriptionsManager.GetSubscriptions(false); IEnumerable <Subscription> clientSubscriptions = subscriptions.Where(x => x.Client.ID == clientId); List <ServiceBusSubscription> serviceBusSubscriptions = new List <ServiceBusSubscription>(); foreach (var subscription in clientSubscriptions) { ServiceBusSubscription serviceBusSubscription = new ServiceBusSubscription { ID = subscription.__PrimaryKey.ToString(), SendBy = subscription.TransportType.ToString(), Callback = subscription.IsCallback, ClientID = subscription.Client.ID, MessageTypeID = subscription.MessageType.ID, Description = subscription.Description, ExpiryDate = subscription.ExpiryDate }; serviceBusSubscriptions.Add(serviceBusSubscription); } return(serviceBusSubscriptions); }
/// <summary> /// Обновить подписку в шине. /// </summary> /// <param name="subscriptionId">Идентификатор подписки, которую нужно обновить.</param> /// <param name="subscription">Подписка.</param> void IServiceBusManager.UpdateSubscription(string subscriptionId, ServiceBusSubscription subscription) { _subscriptionsManager.UpdateSubscription(subscriptionId, subscription); }