Esempio n. 1
0
        protected override ILink CreateLink()
        {
            Attach frame = CreateAttachFrame();

            string linkName = producerInfo.Id + ":" + UriUtil.GetAddress(Destination, Session.Connection);

            link = new SenderLink(Session.InnerSession as Amqp.Session, linkName, frame, OnAttachedResp);

            return(link);
        }
Esempio n. 2
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);
        }