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);
        }
        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);
                }
            }
        }
예제 #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
            });
        }
예제 #4
0
 bool Equals(LegacyAddress obj) => string.Equals(Queue, obj.Queue) && string.Equals(Machine, obj.Machine);