예제 #1
0
        public void Unsubscribe(string client, IEnumerable <string> messageTypes)
        {
            var ids = messageTypes
                      .Select(m => Subscription.FormatId(Endpoint, m, client))
                      .ToList();

            using (var session = Store.OpenSession()) {
                ids.ForEach(id => session.Advanced.DatabaseCommands.Delete(id, null));

                session.SaveChanges();
            }
        }
예제 #2
0
        void ISubscriptionStorage.Unsubscribe(Address client, IEnumerable <MessageType> messageTypes)
        {
            var ids = messageTypes
                      .Select(m => Subscription.FormatId(Endpoint, m, client.ToString()))
                      .ToList();

            using (var session = OpenSession())
            {
                ids.ForEach(id => session.Advanced.DatabaseCommands.Delete(id, null));

                session.SaveChanges();
            }
        }
예제 #3
0
        public void Subscribe(string client, IEnumerable <string> messageTypes)
        {
            var subscriptions = messageTypes.Select(m => new Subscription {
                Id          = Subscription.FormatId(Endpoint, m, client),
                MessageType = m,
                Client      = client
            }).ToList();

            try
            {
                using (var session = Store.OpenSession())
                {
                    session.Advanced.UseOptimisticConcurrency = true;
                    subscriptions.ForEach(session.Store);
                    session.SaveChanges();
                }
            }
            catch (RavenDbExceptions.ConcurrencyException ex)
            {
            }
        }
예제 #4
0
        void ISubscriptionStorage.Subscribe(Address client, IEnumerable <MessageType> messageTypes)
        {
            var subscriptions = messageTypes.Select(m => new Subscription
            {
                Id          = Subscription.FormatId(Endpoint, m, client.ToString()),
                MessageType = m,
                Client      = client
            }).ToList();

            try
            {
                using (var session = OpenSession())
                {
                    session.Advanced.UseOptimisticConcurrency = true;
                    subscriptions.ForEach(session.Store);
                    session.SaveChanges();
                }
            }
            catch (ConcurrencyException ex)
            {
            }
        }