org.apache.activemq.command.ActiveMQTempTopic Java Examples

The following examples show how to use org.apache.activemq.command.ActiveMQTempTopic. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TempDestDeleteTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
   super.setUp();
   connection = createConnection();
   connection.start();

   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

   tempTopic = (ActiveMQTempTopic) session.createTemporaryTopic();
   topicConsumerEventSource = new ConsumerEventSource(connection, tempTopic);
   topicConsumerEventSource.setConsumerListener(this);

   tempQueue = (ActiveMQTempQueue) session.createTemporaryQueue();
   queueConsumerEventSource = new ConsumerEventSource(connection, tempQueue);
   queueConsumerEventSource.setConsumerListener(this);
}
 
Example #2
Source File: Job.java    From chipster with MIT License 6 votes vote down vote up
void setReplyTo(Destination replyTo) {
	if (replyTo instanceof ActiveMQTempTopic) {
		ActiveMQTempTopic tempTopic = (ActiveMQTempTopic) replyTo;
		this.replyToConnectionId = tempTopic.getConnectionId();
		this.replyToSequenceId = tempTopic.getSequenceId();
		this.replyToName = null;
	} else if (replyTo instanceof ActiveMQTopic) {
		ActiveMQTopic topic = (ActiveMQTopic) replyTo;
		try {
			this.replyToConnectionId = null;
			this.replyToSequenceId = 0;
			this.replyToName = topic.getTopicName();
		} catch (JMSException e) {
			throw new IllegalArgumentException("unable to get topic name", e);
		}
	} else {
		throw new IllegalArgumentException("unknown destination type " + replyTo.getClass().getName());
	}
}
 
Example #3
Source File: RequestReplyTempDestRemovalAdvisoryRaceTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private void noConsumerAdvisory() throws JMSException {
   for (BrokerItem item : brokers.values()) {
      ActiveMQConnectionFactory brokerAFactory = new ActiveMQConnectionFactory(item.broker.getTransportConnectorByScheme("tcp").getName() + "?jms.watchTopicAdvisories=false");
      Connection connection = brokerAFactory.createConnection();
      connection.start();
      connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(AdvisorySupport.getNoTopicConsumersAdvisoryTopic(new ActiveMQTempTopic(">"))).setMessageListener(new MessageListener() {
         @Override
         public void onMessage(Message message) {
            sendsWithNoConsumers.incrementAndGet();
         }
      });
   }
}
 
Example #4
Source File: RequestReplyTempDestRemovalAdvisoryRaceTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
   super.setUp();
   responseReceived.set(0);
   respondentSendError.set(0);
   forwardFailures.set(0);
   sendsWithNoConsumers.set(0);
   networkConnectors.clear();
   advisoryConsumerConnections.clear();
   consumerDemandExists = new CountDownLatch(1);
   createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_A + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
   createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_B + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
   createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_C + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);

   PolicyMap map = new PolicyMap();
   PolicyEntry defaultEntry = new PolicyEntry();
   defaultEntry.setSendAdvisoryIfNoConsumers(true);
   DeadLetterStrategy deadletterStrategy = new SharedDeadLetterStrategy();
   deadletterStrategy.setProcessNonPersistent(true);
   defaultEntry.setDeadLetterStrategy(deadletterStrategy);
   defaultEntry.setDispatchPolicy(new PriorityDispatchPolicy());
   map.put(new ActiveMQTempTopic(">"), defaultEntry);

   for (BrokerItem item : brokers.values()) {
      item.broker.setDestinationPolicy(map);
   }
}
 
Example #5
Source File: JobManagerDB.java    From chipster with MIT License 5 votes vote down vote up
/**
 * 
 * @param jobId
 * @param newClientReplyTo
 * @return null if job not found
 */
public Job updateJobReplyTo(String jobId, Destination newClientReplyTo) {
	Job job = getJob(jobId);

	if (job == null) {
		return null;
	}

	job.setReplyTo((ActiveMQTempTopic) newClientReplyTo);

	updateJob(job);

	return job;
}
 
Example #6
Source File: Job.java    From chipster with MIT License 5 votes vote down vote up
Job(JobMessage jobMessage) {
	this.jobId = UUID.fromString(jobMessage.getJobId());
	setJobMessage(jobMessage);
	setReplyTo((ActiveMQTempTopic) jobMessage.getReplyTo());
	this.created = new Date();
	this.state = JobState.WAITING;
}
 
Example #7
Source File: Job.java    From chipster with MIT License 5 votes vote down vote up
public Destination getReplyTo() {
	if (this.replyToName != null) {
		return new ActiveMQTopic(this.replyToName);
	} else {
		return new ActiveMQTempTopic(new ConnectionId(this.replyToConnectionId), replyToSequenceId);
	}
}
 
Example #8
Source File: ActiveMQTempTopicTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public Object createObject() throws Exception {
   ActiveMQTempTopic info = new ActiveMQTempTopic();
   populateObject(info);
   return info;
}
 
Example #9
Source File: ActiveMQTempTopicTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ActiveMQTempTopic info = (ActiveMQTempTopic) object;

}
 
Example #10
Source File: ActiveMQTempTopicTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public Object createObject() throws Exception {
   ActiveMQTempTopic info = new ActiveMQTempTopic();
   populateObject(info);
   return info;
}
 
Example #11
Source File: ActiveMQTempTopicTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ActiveMQTempTopic info = (ActiveMQTempTopic) object;

}
 
Example #12
Source File: MessageTransformationTest.java    From activemq-artemis with Apache License 2.0 3 votes vote down vote up
/**
 * Tests transforming destinations into ActiveMQ's destination
 * implementation.
 */
public void testTransformDestination() throws Exception {
   assertTrue("Transforming a TempQueue destination to an ActiveMQTempQueue", ActiveMQMessageTransformation.transformDestination(new ActiveMQTempQueue()) instanceof ActiveMQTempQueue);

   assertTrue("Transforming a TempTopic destination to an ActiveMQTempTopic", ActiveMQMessageTransformation.transformDestination(new ActiveMQTempTopic()) instanceof ActiveMQTempTopic);

   assertTrue("Transforming a Queue destination to an ActiveMQQueue", ActiveMQMessageTransformation.transformDestination(new ActiveMQQueue()) instanceof ActiveMQQueue);

   assertTrue("Transforming a Topic destination to an ActiveMQTopic", ActiveMQMessageTransformation.transformDestination(new ActiveMQTopic()) instanceof ActiveMQTopic);

   assertTrue("Transforming a Destination to an ActiveMQDestination", ActiveMQMessageTransformation.transformDestination(new ActiveMQTopic()) instanceof ActiveMQDestination);
}