Ejemplo n.º 1
0
        public void BeforeConversionToDocument(string key, object entity, RavenJObject metadata)
        {
            if (!(entity is Subscription subscription))
            {
                return;
            }

            var converted = LegacyAddress.ConvertMultipleToLegacyAddress(subscription.Subscribers);

            subscription.LegacySubscriptions.Clear();
            subscription.LegacySubscriptions.AddRange(converted);
        }
Ejemplo n.º 2
0
        public void AfterConversionToEntity(string key, RavenJObject document, RavenJObject metadata, object entity)
        {
            if (!(entity is Subscription subscription))
            {
                return;
            }

            var clients = document["Clients"];

            if (clients != null)
            {
                var converted = LegacyAddress.ParseMultipleToSubscriptionClient(subscription.LegacySubscriptions);

                var legacySubscriptions = converted.Except(subscription.Subscribers).ToArray();
                foreach (var legacySubscription in legacySubscriptions)
                {
                    subscription.Subscribers.Add(legacySubscription);
                }
            }
        }
Ejemplo n.º 3
0
        public static SubscriptionClient ParseToSubscriptionClient(LegacyAddress address)
        {
            var queue   = address.Queue;
            var machine = address.Machine;

            // Previously known as IgnoreMachineName (for brokers)
            if (string.IsNullOrEmpty(machine))
            {
                return(new SubscriptionClient
                {
                    TransportAddress = queue,
                    Endpoint = null
                });
            }

            return(new SubscriptionClient
            {
                TransportAddress = queue + "@" + machine,
                Endpoint = null
            });
        }
Ejemplo n.º 4
0
 bool Equals(LegacyAddress obj) => string.Equals(Queue, obj.Queue) && string.Equals(Machine, obj.Machine);