Java Code Examples for org.springframework.jms.core.JmsTemplate#setTimeToLive()
The following examples show how to use
org.springframework.jms.core.JmsTemplate#setTimeToLive() .
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: JmsContainerManagerTest.java From c2mon with GNU Lesser General Public License v3.0 | 6 votes |
@Before public void setUp() throws Exception { mockProcessCache = EasyMock.createMock(ProcessCache.class); mockListener = EasyMock.createMock(SessionAwareMessageListener.class); mockClusterCache = EasyMock.createMock(ClusterCache.class); jmsSender = new ActiveJmsSender(); JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(daqInConnectionFactory); template.setTimeToLive(60000); jmsSender.setJmsTemplate(template); // jmsContainerManager = new JmsContainerManagerImpl(mockProcessCache, daqInConnectionFactory, mockListener, mockClusterCache, new StandardEnvironment()); // jmsContainerManager.setConsumersInitial(1); // jmsContainerManager.setConsumersMax(1); // jmsContainerManager.setNbExecutorThreads(2); // jmsContainerManager.setIdleTaskExecutionLimit(1); // jmsContainerManager.setMaxMessages(1); // jmsContainerManager.setReceiveTimeout(100); // jmsContainerManager.setJmsUpdateQueueTrunk(testTrunkName); // jmsContainerManager.setSessionTransacted(true); // jmsContainerManager.setUpdateWarmUpSeconds(60); }
Example 2
Source File: JmsTopicTemplateFactory.java From c2mon with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates a new {@link JmsTemplate} with standardized configuration * @param connectionFactory The JMS connection factory * @param clientTopicMsgTimeToLive Time-to-live in seconds * @return A new {@link JmsTemplate} instance with standardized configuration */ static JmsTemplate createJmsTemplate(ConnectionFactory connectionFactory, int clientTopicMsgTimeToLive) { JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory); jmsTemplate.setExplicitQosEnabled(true); // message time-to-live in ms long ttl = clientTopicMsgTimeToLive * 1000L; jmsTemplate.setTimeToLive(ttl); jmsTemplate.setDeliveryPersistent(false); jmsTemplate.setSessionTransacted(false); return jmsTemplate; }
Example 3
Source File: JmsConfig.java From c2mon with GNU Lesser General Public License v3.0 | 5 votes |
private void addDefaultProcessRequestJmsTemplateProperties(JmsTemplate jmsTemplate) { String queueTrunk = properties.getJms().getQueuePrefix(); jmsTemplate.setDefaultDestination(new ActiveMQQueue(queueTrunk + ".request")); jmsTemplate.setExplicitQosEnabled(true); // timeToLive the message's lifetime (in milliseconds) long ttl = properties.getJms().getRequestMsgtimeToLive() * 1000L; jmsTemplate.setTimeToLive(ttl); jmsTemplate.setDeliveryPersistent(false); }