Esempio n. 1
0
        private Source CreateSource()
        {
            Source source = new Source();

            source.Address  = AmqpDestinationHelper.GetDestinationAddress(info.Destination, session.Connection);
            source.Outcomes = new[]
            {
                SymbolUtil.ATTACH_OUTCOME_ACCEPTED,
                SymbolUtil.ATTACH_OUTCOME_RELEASED,
                SymbolUtil.ATTACH_OUTCOME_REJECTED,
                SymbolUtil.ATTACH_OUTCOME_MODIFIED
            };
            source.DefaultOutcome = MessageSupport.MODIFIED_FAILED_INSTANCE;

            if (info.IsDurable)
            {
                source.ExpiryPolicy     = SymbolUtil.ATTACH_EXPIRY_POLICY_NEVER;
                source.Durable          = (int)TerminusDurability.UNSETTLED_STATE;
                source.DistributionMode = SymbolUtil.ATTACH_DISTRIBUTION_MODE_COPY;
            }
            else
            {
                source.ExpiryPolicy = SymbolUtil.ATTACH_EXPIRY_POLICY_SESSION_END;
                source.Durable      = (int)TerminusDurability.NONE;
            }

            if (info.IsBrowser)
            {
                source.DistributionMode = SymbolUtil.ATTACH_DISTRIBUTION_MODE_COPY;
            }

            source.Capabilities = new[] { SymbolUtil.GetTerminusCapabilitiesForDestination(info.Destination) };

            Map filters = new Map();

            if (info.NoLocal)
            {
                filters.Add(SymbolUtil.ATTACH_FILTER_NO_LOCAL, AmqpNmsNoLocalType.NO_LOCAL);
            }

            if (info.HasSelector)
            {
                filters.Add(SymbolUtil.ATTACH_FILTER_SELECTOR, new AmqpNmsSelectorType(info.Selector));
            }

            if (filters.Count > 0)
            {
                source.FilterSet = filters;
            }

            return(source);
        }
Esempio n. 2
0
        private Target CreateTarget()
        {
            Target target = new Target();

            target.Address = AmqpDestinationHelper.GetDestinationAddress(info.Destination, session.Connection);

            // Durable is used for a durable subscription
            target.Durable = (uint)TerminusDurability.NONE;

            if (info.Destination != null)
            {
                target.Capabilities = new[] { SymbolUtil.GetTerminusCapabilitiesForDestination(info.Destination) };
            }

            target.Dynamic = false;

            return(target);
        }
Esempio n. 3
0
        private Target CreateTarget()
        {
            Target t = new Target();

            t.Address = UriUtil.GetAddress(Destination, this.Session.Connection);

            t.Timeout = (uint)producerInfo.sendTimeout;

            // Durable is used for a durable subscription
            t.Durable = (uint)TerminusDurability.NONE;

            if (Destination != null)
            {
                t.Capabilities = new[] { SymbolUtil.GetTerminusCapabilitiesForDestination(Destination) };
            }
            t.Dynamic = false;

            return(t);
        }
        private Source CreateSource()
        {
            Source source = new Source();

            source.Address  = UriUtil.GetAddress(Destination, this.Session.Connection);
            source.Outcomes = new Amqp.Types.Symbol[]
            {
                SymbolUtil.ATTACH_OUTCOME_ACCEPTED,
                SymbolUtil.ATTACH_OUTCOME_RELEASED,
                SymbolUtil.ATTACH_OUTCOME_REJECTED,
                SymbolUtil.ATTACH_OUTCOME_MODIFIED
            };
            source.DefaultOutcome = MessageSupport.MODIFIED_FAILED_INSTANCE;

            if (this.IsDurable)
            {
                source.ExpiryPolicy     = SymbolUtil.ATTACH_EXPIRY_POLICY_NEVER;
                source.Durable          = (int)TerminusDurability.UNSETTLED_STATE;
                source.DistributionMode = SymbolUtil.ATTACH_DISTRIBUTION_MODE_COPY;
            }
            else
            {
                source.ExpiryPolicy = SymbolUtil.ATTACH_EXPIRY_POLICY_SESSION_END;
                source.Durable      = (int)TerminusDurability.NONE;
            }

            if (this.IsBrowser)
            {
                source.DistributionMode = SymbolUtil.ATTACH_DISTRIBUTION_MODE_COPY;
            }

            source.Capabilities = new[] { SymbolUtil.GetTerminusCapabilitiesForDestination(Destination) };

            Amqp.Types.Map filters = new Amqp.Types.Map();

            // TODO add filters for noLocal and Selector using appropriate Amqp Described types

            // No Local
            // qpid jms defines a no local filter as an amqp described type
            //      AmqpJmsNoLocalType where
            //          Descriptor = 0x0000468C00000003UL
            //          Described = "NoLocalFilter{}" (type string)
            if (consumerInfo.NoLocal)
            {
                filters.Add(SymbolUtil.ATTACH_FILTER_NO_LOCAL, "NoLocalFilter{}");
            }

            // Selector
            // qpid jms defines a selector filter as an amqp described type
            //      AmqpJmsSelectorType where
            //          Descriptor = 0x0000468C00000004UL
            //          Described = "<selector_string>" (type string)
            if (this.HasSelector)
            {
                filters.Add(SymbolUtil.ATTACH_FILTER_SELECTOR, this.consumerInfo.Selector);
            }

            // Assign filters
            if (filters.Count > 0)
            {
                source.FilterSet = filters;
            }

            return(source);
        }