Java Code Examples for org.apache.activemq.ActiveMQConnectionFactory#setSendTimeout()

The following examples show how to use org.apache.activemq.ActiveMQConnectionFactory#setSendTimeout() . 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: JmsFactory.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public static ConnectionFactory createConnectionFactory(final String url, final int timeoutMillis, final String jmsProvider) throws JMSException {
    switch (jmsProvider) {
        case ACTIVEMQ_PROVIDER: {
            final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);
            factory.setSendTimeout(timeoutMillis);
            return factory;
        }
        default:
            throw new IllegalArgumentException("Unknown JMS Provider: " + jmsProvider);
    }
}
 
Example 2
Source File: EventRegistryJmsConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Bean
public CachingConnectionFactory cachingJmsConnectionFactory() {
    // configuration properties are Spring Boot defaults
    ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
    activeMQConnectionFactory.setCloseTimeout((int) Duration.ofSeconds(15).toMillis());
    activeMQConnectionFactory.setNonBlockingRedelivery(false);
    activeMQConnectionFactory.setSendTimeout(0); // wait forever

    CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(activeMQConnectionFactory);
    cachingConnectionFactory.setCacheConsumers(false);
    cachingConnectionFactory.setCacheProducers(true);
    cachingConnectionFactory.setSessionCacheSize(1);

    return cachingConnectionFactory;
}
 
Example 3
Source File: JmsFactory.java    From nifi with Apache License 2.0 5 votes vote down vote up
public static ConnectionFactory createConnectionFactory(final String url, final int timeoutMillis, final String jmsProvider) throws JMSException {
    switch (jmsProvider) {
        case ACTIVEMQ_PROVIDER: {
            final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);
            factory.setSendTimeout(timeoutMillis);
            return factory;
        }
        default:
            throw new IllegalArgumentException("Unknown JMS Provider: " + jmsProvider);
    }
}