Пример #1
0
        public ActiveMQTempDestination CreateTemporaryDestination(bool topic)
        {
            ActiveMQTempDestination destination = null;

            if (topic)
            {
                destination = new ActiveMQTempTopic(
                    info.ConnectionId.Value + ":" + Interlocked.Increment(ref temporaryDestinationCounter));
            }
            else
            {
                destination = new ActiveMQTempQueue(
                    info.ConnectionId.Value + ":" + Interlocked.Increment(ref temporaryDestinationCounter));
            }

            DestinationInfo command = new DestinationInfo();

            command.ConnectionId  = ConnectionId;
            command.OperationType = DestinationInfo.ADD_OPERATION_TYPE;             // 0 is add
            command.Destination   = destination;

            this.SyncRequest(command);

            destination.Connection = this;
            this.AddTempDestination(destination);

            return(destination);
        }
Пример #2
0
        public void TestCopy()
        {
            this.nmsMessageID     = "ID:1141:45278:429";
            this.nmsCorrelationID = "testcorrelationid";
            this.nmsDestination   = new ActiveMQTopic("test.topic");
            this.nmsReplyTo       = new ActiveMQTempTopic("test.replyto.topic:001");
            this.nmsDeliveryMode  = MsgDeliveryMode.NonPersistent;
            this.nmsType          = "test type";
            this.nmsPriority      = MsgPriority.High;
            this.nmsTimestamp     = DateTime.Now;

            ActiveMQMessage msg1 = new ActiveMQMessage();

            msg1.NMSMessageId       = this.nmsMessageID;
            msg1.NMSCorrelationID   = this.nmsCorrelationID;
            msg1.FromDestination    = this.nmsDestination;
            msg1.NMSReplyTo         = this.nmsReplyTo;
            msg1.NMSDeliveryMode    = this.nmsDeliveryMode;
            msg1.NMSType            = this.nmsType;
            msg1.NMSPriority        = this.nmsPriority;
            msg1.NMSTimestamp       = this.nmsTimestamp;
            msg1.ReadOnlyProperties = true;

            ActiveMQMessage msg2 = msg1.Clone() as ActiveMQMessage;

            Assert.IsTrue(msg1.NMSMessageId.Equals(msg2.NMSMessageId));
            Assert.IsTrue(msg1.NMSCorrelationID.Equals(msg2.NMSCorrelationID));
            Assert.IsTrue(msg1.NMSDestination.Equals(msg2.NMSDestination));
            Assert.IsTrue(msg1.NMSReplyTo.Equals(msg2.NMSReplyTo));
            Assert.IsTrue(msg1.NMSDeliveryMode == msg2.NMSDeliveryMode);
            Assert.IsTrue(msg1.NMSRedelivered == msg2.NMSRedelivered);
            Assert.IsTrue(msg1.NMSType.Equals(msg2.NMSType));
            Assert.IsTrue(msg1.NMSPriority == msg2.NMSPriority);
            Assert.IsTrue(msg1.NMSTimestamp == msg2.NMSTimestamp);
        }
Пример #3
0
        public ITemporaryTopic CreateTemporaryTopic()
        {
            ActiveMQTempTopic answer = new ActiveMQTempTopic(connection.CreateTemporaryDestinationName());

            CreateTemporaryDestination(answer);
            return(answer);
        }
Пример #4
0
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {
            ActiveMQTempTopic info = (ActiveMQTempTopic)o;

            int rc = base.TightMarshal1(wireFormat, info, bs);

            return(rc + 0);
        }
Пример #5
0
        private Mock <IMessageConsumer> SetupCreateTemporaryTopicConsumer(Mock <ISession> session, string Selector, string topicName)
        {
            var consumer    = new Mock <IMessageConsumer>();
            var destination = new ActiveMQTempTopic(topicName);

            session.Setup(s => s.CreateTemporaryTopic()).Returns(destination);
            session.Setup(s => s.CreateConsumer(destination, Selector)).Returns(consumer.Object);
            return(consumer);
        }
Пример #6
0
        public virtual void SetUp()
        {
            this.nmsMessageID     = "testid";
            this.nmsCorrelationID = "testcorrelationid";
            this.nmsDestination   = new ActiveMQTopic("TEST.test.topic");
            this.nmsReplyTo       = new ActiveMQTempTopic("TEST.test.replyto.topic:001");
            this.nmsDeliveryMode  = MsgDeliveryMode.NonPersistent;
            this.nmsRedelivered   = true;
            this.nmsType          = "test type";
            this.nmsPriority      = MsgPriority.High;
            this.nmsTimestamp     = DateTime.Now;
            this.consumerIDs      = new long[3];

            for (int i = 0; i < this.consumerIDs.Length; i++)
            {
                this.consumerIDs[i] = i;
            }
        }