Search in sources :

Example 41 with JmsTemplate

use of org.springframework.jms.core.JmsTemplate in project opennms by OpenNMS.

the class JmsNorthbounder method afterPropertiesSet.

/* (non-Javadoc)
     * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
     */
@Override
public void afterPropertiesSet() throws Exception {
    BeanUtils.assertAutowiring(this);
    LOG.debug("creating new JmsTemplate with connection to {}", m_jmsDestination.getJmsDestination());
    m_template = new JmsTemplate(m_jmsNorthbounderConnectionFactory);
    if (m_jmsDestination.getDestinationType().equals(DestinationType.TOPIC)) {
        m_template.setPubSubDomain(true);
    }
    setNaglesDelay(m_config.getNaglesDelay());
    setMaxBatchSize(m_config.getBatchSize());
    setMaxPreservedAlarms(m_config.getQueueSize());
}
Also used : JmsTemplate(org.springframework.jms.core.JmsTemplate)

Example 42 with JmsTemplate

use of org.springframework.jms.core.JmsTemplate in project opennms by OpenNMS.

the class JmsNorthBounderTest method startBroker.

/**
     * Start broker.
     *
     * @throws InterruptedException the interrupted exception
     */
@Before
public void startBroker() throws InterruptedException {
    MockLogAppender.setupLogging();
    // this spawns an embedded broker
    m_template = new JmsTemplate(m_jmsNorthbounderConnectionFactory);
    m_template.setReceiveTimeout(100L);
}
Also used : JmsTemplate(org.springframework.jms.core.JmsTemplate) Before(org.junit.Before)

Example 43 with JmsTemplate

use of org.springframework.jms.core.JmsTemplate in project opennms by OpenNMS.

the class AppConfig method jmsTemplate.

@Bean(name = "JmsTemplate")
public JmsTemplate jmsTemplate() {
    JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory());
    jmsTemplate.setDeliveryPersistent(false);
    jmsTemplate.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
    jmsTemplate.setExplicitQosEnabled(true);
    jmsTemplate.setTimeToLive(120000);
    return jmsTemplate;
}
Also used : JmsTemplate(org.springframework.jms.core.JmsTemplate) Bean(org.springframework.context.annotation.Bean)

Example 44 with JmsTemplate

use of org.springframework.jms.core.JmsTemplate in project av-service by dvoraka.

the class JmsServerConfig method fileServerJmsTemplate.

@Bean
public JmsTemplate fileServerJmsTemplate(ConnectionFactory serverConnectionFactory, MessageConverter fileServerMessageConverter) {
    JmsTemplate template = new JmsTemplate(serverConnectionFactory);
    template.setReceiveTimeout(receiveTimeout);
    template.setMessageConverter(fileServerMessageConverter);
    return template;
}
Also used : JmsTemplate(org.springframework.jms.core.JmsTemplate) Bean(org.springframework.context.annotation.Bean)

Example 45 with JmsTemplate

use of org.springframework.jms.core.JmsTemplate in project av-service by dvoraka.

the class JmsBridgeOutputConfig method outJmsTemplate.

@Bean
public JmsTemplate outJmsTemplate(ConnectionFactory outConnectionFactory, MessageConverter outMessageConverter) {
    JmsTemplate template = new JmsTemplate(outConnectionFactory);
    template.setReceiveTimeout(receiveTimeout);
    template.setMessageConverter(outMessageConverter);
    return template;
}
Also used : JmsTemplate(org.springframework.jms.core.JmsTemplate) Bean(org.springframework.context.annotation.Bean)

Aggregations

JmsTemplate (org.springframework.jms.core.JmsTemplate)45 Test (org.junit.Test)30 ConnectionFactory (javax.jms.ConnectionFactory)12 Session (javax.jms.Session)9 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)8 Connection (javax.jms.Connection)7 TransactionStatus (org.springframework.transaction.TransactionStatus)7 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)7 Bean (org.springframework.context.annotation.Bean)5 Destination (javax.jms.Destination)4 TextMessage (javax.jms.TextMessage)4 CamelContext (org.apache.camel.CamelContext)4 SessionCallback (org.springframework.jms.core.SessionCallback)4 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)4 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)4 JMSException (javax.jms.JMSException)3 Message (javax.jms.Message)3 PooledConnectionFactory (org.apache.activemq.pool.PooledConnectionFactory)3 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)3 JmsOperations (org.springframework.jms.core.JmsOperations)3