/** * Create a Destination * @param type * @param pyhsicalName * @return */ public static ActiveMQDestination CreateDestination(int type, String pyhsicalName) { ActiveMQDestination result = null; if (pyhsicalName == null) { return(null); } else if (type == ACTIVEMQ_TOPIC) { result = new ActiveMQTopic(pyhsicalName); } else if (type == ACTIVEMQ_TEMPORARY_TOPIC) { result = new ActiveMQTempTopic(pyhsicalName); } else if (type == ACTIVEMQ_QUEUE) { result = new ActiveMQQueue(pyhsicalName); } else { result = new ActiveMQTempQueue(pyhsicalName); } return(result); }
/// <summary> /// Create a Destination /// </summary> /// <param name="type"></param> /// <param name="pyhsicalName"></param> /// <returns></returns> public static ActiveMQDestination CreateDestination(int type, String pyhsicalName) { ActiveMQDestination result = null; if (pyhsicalName == null) { return(null); } else { switch (type) { case ACTIVEMQ_TOPIC: result = new ActiveMQTopic(pyhsicalName); break; case ACTIVEMQ_TEMPORARY_TOPIC: result = new ActiveMQTempTopic(pyhsicalName); break; case ACTIVEMQ_QUEUE: result = new ActiveMQQueue(pyhsicalName); break; default: result = new ActiveMQTempQueue(pyhsicalName); break; } } return(result); }
/** * @param destination */ public static ActiveMQDestination Transform(IDestination destination) { ActiveMQDestination result = null; if (destination != null) { if (destination is ActiveMQDestination) { result = (ActiveMQDestination)destination; } else { if (destination is ITemporaryQueue) { result = new ActiveMQTempQueue(((IQueue)destination).QueueName); } else if (destination is ITemporaryTopic) { result = new ActiveMQTempTopic(((ITopic)destination).TopicName); } else if (destination is IQueue) { result = new ActiveMQQueue(((IQueue)destination).QueueName); } else if (destination is ITopic) { result = new ActiveMQTopic(((ITopic)destination).TopicName); } } } return(result); }
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; }
public override Object Clone() { // Since we are a derived class use the base's Clone() // to perform the shallow copy. Since it is shallow it // will include our derived class. Since we are derived, // this method is an override. ActiveMQTempTopic o = (ActiveMQTempTopic)base.Clone(); // Now do the deep work required // If any new variables are added then this routine will // likely need updating return(o); }
public virtual void SetUp() { this.nmsMessageID = "testid"; this.nmsCorrelationID = "testcorrelationid"; this.nmsDestination = new ActiveMQTopic("test.topic"); this.nmsReplyTo = new ActiveMQTempTopic("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; } }
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; return destination; }
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); }
/// <summary> /// Create a Destination /// </summary> /// <param name="type"></param> /// <param name="pyhsicalName"></param> /// <returns></returns> public static ActiveMQDestination CreateDestination(int type, String pyhsicalName) { ActiveMQDestination result = null; if(pyhsicalName == null) { return null; } else switch(type) { case ACTIVEMQ_TOPIC: result = new ActiveMQTopic(pyhsicalName); break; case ACTIVEMQ_TEMPORARY_TOPIC: result = new ActiveMQTempTopic(pyhsicalName); break; case ACTIVEMQ_QUEUE: result = new ActiveMQQueue(pyhsicalName); break; default: result = new ActiveMQTempQueue(pyhsicalName); break; } return result; }
/// <summary> /// </summary> /// <param name="destination"></param> /// <returns></returns> public static ActiveMQDestination Transform(IDestination destination) { ActiveMQDestination result = null; if(destination != null) { if(destination is ActiveMQDestination) { result = (ActiveMQDestination) destination; } else { if(destination is ITemporaryQueue) { result = new ActiveMQTempQueue(((IQueue) destination).QueueName); } else if(destination is ITemporaryTopic) { result = new ActiveMQTempTopic(((ITopic) destination).TopicName); } else if(destination is IQueue) { result = new ActiveMQQueue(((IQueue) destination).QueueName); } else if(destination is ITopic) { result = new ActiveMQTopic(((ITopic) destination).TopicName); } } } return result; }