Пример #1
0
        protected virtual void WriteConsumerInfo(ConsumerInfo command, BinaryWriter dataOut)
        {
            var frame = new StompFrame("SUBSCRIBE", _encodeHeaders);

            if (command.ResponseRequired)
            {
                frame.SetProperty(PropertyKeys.Receipt, command.CommandId);
            }

            frame.SetProperty(PropertyKeys.Destination, command.Destination?.ConvertToStompString());
            frame.SetProperty(PropertyKeys.Id, command.ConsumerId.ToString());
            frame.SetProperty(PropertyKeys.DurableSubscriberName, command.SubscriptionName);
            frame.SetProperty(PropertyKeys.Selector, command.Selector);
            frame.SetProperty(PropertyKeys.Ack, StompHelper.ToStomp(command.AckMode));

            if (command.NoLocal)
            {
                frame.SetProperty(PropertyKeys.NoLocal, command.NoLocal.ToString());
            }

            // ActiveMQ extensions to STOMP
            frame.SetProperty(PropertyKeys.Transformation, command.Transformation ?? "jms-xml");

            frame.SetProperty(PropertyKeys.ActivemqDispatchAsync, command.DispatchAsync);

            if (command.Exclusive)
            {
                frame.SetProperty(PropertyKeys.ActivemqExclusive, command.Exclusive);
            }

            if (command.SubscriptionName != null)
            {
                frame.SetProperty(PropertyKeys.ActivemqSubscriptionName, command.SubscriptionName);
                // For an older 4.0 broker we need to set this header so they get the
                // subscription as well..
                frame.SetProperty(PropertyKeys.ActivemqSubcriptionName, command.SubscriptionName);
            }

            frame.SetProperty(PropertyKeys.ActivemqMaximumPendingMessageLimit, command.MaximumPendingMessageLimit);
            frame.SetProperty(PropertyKeys.ActivemqPrefetchSize, command.PrefetchSize);
            frame.SetProperty(PropertyKeys.ActivemqPriority, command.Priority);

            if (command.Retroactive)
            {
                frame.SetProperty(PropertyKeys.ActivemqRetroactive, command.Retroactive);
            }

            frame.ToStream(dataOut);
        }
Пример #2
0
        protected virtual void WriteConsumerInfo(ConsumerInfo command, BinaryWriter dataOut)
        {
            var frame = new StompFrame("SUBSCRIBE", _encodeHeaders);

            if (command.ResponseRequired)
            {
                frame.SetProperty("receipt", command.CommandId);
            }

            frame.SetProperty("destination", Destination.ConvertToStompString(command.Destination));
            frame.SetProperty("id", command.ConsumerId.ToString());
            frame.SetProperty("durable-subscriber-name", command.SubscriptionName);
            frame.SetProperty("selector", command.Selector);
            frame.SetProperty("ack", StompHelper.ToStomp(command.AckMode));

            if (command.NoLocal)
            {
                frame.SetProperty("no-local", command.NoLocal.ToString());
            }

            // ActiveMQ extensions to STOMP
            frame.SetProperty("transformation", command.Transformation ?? "jms-xml");

            frame.SetProperty("activemq.dispatchAsync", command.DispatchAsync);

            if (command.Exclusive)
            {
                frame.SetProperty("activemq.exclusive", command.Exclusive);
            }

            if (command.SubscriptionName != null)
            {
                frame.SetProperty("activemq.subscriptionName", command.SubscriptionName);
                // For an older 4.0 broker we need to set this header so they get the
                // subscription as well..
                frame.SetProperty("activemq.subcriptionName", command.SubscriptionName);
            }

            frame.SetProperty("activemq.maximumPendingMessageLimit", command.MaximumPendingMessageLimit);
            frame.SetProperty("activemq.prefetchSize", command.PrefetchSize);
            frame.SetProperty("activemq.priority", command.Priority);

            if (command.Retroactive)
            {
                frame.SetProperty("activemq.retroactive", command.Retroactive);
            }

            frame.ToStream(dataOut);
        }