Example usage for org.springframework.jms.core JmsTemplate setReceiveTimeout

List of usage examples for org.springframework.jms.core JmsTemplate setReceiveTimeout

Introduction

In this page you can find the example usage for org.springframework.jms.core JmsTemplate setReceiveTimeout.

Prototype

public void setReceiveTimeout(long receiveTimeout) 

Source Link

Document

Set the timeout to use for receive calls (in milliseconds).

Usage

From source file:com.alliander.osgp.adapter.protocol.iec61850.application.config.MessagingConfig.java

@Bean
public JmsTemplate osgpRequestsJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.osgpRequestsQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSGP_REQUESTS_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(/*from w ww.  j  a  v  a  2  s. c  o  m*/
            Long.parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSGP_REQUESTS_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSGP_REQUESTS_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long
            .parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSGP_REQUESTS_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.application.config.MessagingConfig.java

@Bean
public JmsTemplate iec61850ResponsesJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.iec61850ResponsesQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_RESPONSES_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_RESPONSES_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_RESPONSES_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_RESPONSES_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:org.osgp.adapter.protocol.dlms.application.config.MessagingConfig.java

@Bean
public JmsTemplate dlmsLogItemRequestsJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.dlmsLogItemRequestsQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_DLMS_LOG_ITEM_REQUESTS_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DLMS_LOG_ITEM_REQUESTS_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_DLMS_LOG_ITEM_REQUESTS_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DLMS_LOG_ITEM_REQUESTS_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.application.config.MessagingConfig.java

@Bean
public JmsTemplate iec61850LogItemRequestsJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.iec61850LogItemRequestsQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_LOG_ITEM_REQUESTS_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_LOG_ITEM_REQUESTS_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_LOG_ITEM_REQUESTS_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long.parseLong(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_IEC61850_LOG_ITEM_REQUESTS_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:com.alliander.osgp.adapter.protocol.oslp.application.config.MessagingConfig.java

@Bean
public JmsTemplate oslpResponsesJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.oslpResponsesQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSLP_RESPONSES_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(Long
            .parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSLP_RESPONSES_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSLP_RESPONSES_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long
            .parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSLP_RESPONSES_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:com.alliander.osgp.adapter.protocol.oslp.application.config.MessagingConfig.java

@Bean
public JmsTemplate oslpLogItemRequestsJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.oslpLogItemRequestsQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_OSLP_LOG_ITEM_REQUESTS_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSLP_LOG_ITEM_REQUESTS_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_OSLP_LOG_ITEM_REQUESTS_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_OSLP_LOG_ITEM_REQUESTS_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:com.alliander.osgp.adapter.protocol.oslp.application.config.MessagingConfig.java

@Bean
public JmsTemplate signingServerRequestsJmsTemplate() {
    final JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setDefaultDestination(this.signingServerRequestsQueue());
    // Enable the use of deliveryMode, priority, and timeToLive
    jmsTemplate.setExplicitQosEnabled(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_SIGNING_SERVER_REQUESTS_EXPLICIT_QOS_ENABLED)));
    jmsTemplate.setTimeToLive(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_SIGNING_SERVER_REQUESTS_TIME_TO_LIVE)));
    jmsTemplate.setDeliveryPersistent(Boolean.parseBoolean(this.environment
            .getRequiredProperty(PROPERTY_NAME_JMS_SIGNING_SERVER_REQUESTS_DELIVERY_PERSISTENT)));
    jmsTemplate.setConnectionFactory(this.pooledConnectionFactory());
    jmsTemplate.setReceiveTimeout(Long.parseLong(
            this.environment.getRequiredProperty(PROPERTY_NAME_JMS_SIGNING_SERVER_REQUESTS_RECEIVE_TIMEOUT)));
    return jmsTemplate;
}

From source file:org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.java

/**
 * Create the JMS template to be used to send the JMS messages.
 *
 * @return/*ww  w .j a  v a2  s  . co  m*/
 */
protected JmsTemplate createTemplate() {
    JmsTemplate tplt;
    if (isJms102()) {
        tplt = new JmsTemplate102();
    } else {
        tplt = new JmsTemplate();
    }
    tplt.setConnectionFactory(getConnectionFactory());
    if (getDestination() != null) {
        tplt.setDefaultDestination(getDestination());
    } else if (getDestinationName() != null) {
        tplt.setDefaultDestinationName(getDestinationName());
    }
    tplt.setDeliveryMode(getDeliveryMode());
    if (getDestinationResolver() != null) {
        tplt.setDestinationResolver(getDestinationResolver());
    }
    tplt.setExplicitQosEnabled(isExplicitQosEnabled());
    tplt.setMessageIdEnabled(isMessageIdEnabled());
    tplt.setMessageTimestampEnabled(isMessageTimestampEnabled());
    tplt.setPriority(getPriority());
    tplt.setPubSubDomain(isPubSubDomain());
    tplt.setPubSubNoLocal(isPubSubNoLocal());
    tplt.setTimeToLive(getTimeToLive());
    tplt.setReceiveTimeout(getReceiveTimeout());
    tplt.afterPropertiesSet();
    return tplt;
}

From source file:com.ruyicai.msgcenter.jms.WithoutTMJmsConfiguration.java

/**
 * Creates a {@link JmsOperations} object used for one way messaging
 *///  www . j av a  2 s .  c  o  m
public JmsOperations createInOnlyTemplate(JmsEndpoint endpoint, boolean pubSubDomain, String destination) {
    if (jmsOperations != null) {
        return jmsOperations;
    }

    ConnectionFactory factory = getTemplateConnectionFactory();
    JmsTemplate template = new CamelJmsTemplate(this, factory);

    template.setPubSubDomain(pubSubDomain);
    if (destinationResolver != null) {
        template.setDestinationResolver(destinationResolver);
        if (endpoint instanceof DestinationEndpoint) {
            LOG.debug(
                    "You are overloading the destinationResolver property on a DestinationEndpoint; are you sure you want to do that?");
        }
    } else if (endpoint instanceof DestinationEndpoint) {
        DestinationEndpoint destinationEndpoint = (DestinationEndpoint) endpoint;
        template.setDestinationResolver(createDestinationResolver(destinationEndpoint));
    }
    template.setDefaultDestinationName(destination);

    template.setExplicitQosEnabled(isExplicitQosEnabled());
    template.setDeliveryPersistent(deliveryPersistent);
    if (messageConverter != null) {
        template.setMessageConverter(messageConverter);
    }
    template.setMessageIdEnabled(messageIdEnabled);
    template.setMessageTimestampEnabled(messageTimestampEnabled);
    if (priority >= 0) {
        template.setPriority(priority);
    }
    template.setPubSubNoLocal(pubSubNoLocal);
    if (receiveTimeout >= 0) {
        template.setReceiveTimeout(receiveTimeout);
    }
    // only set TTL if we have a positive value and it has not been disabled
    if (timeToLive >= 0 && !isDisableTimeToLive()) {
        template.setTimeToLive(timeToLive);
    }

    template.setSessionTransacted(transacted);
    if (transacted) {
        template.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
    } else {
        // This is here for completeness, but the template should not get
        // used for receiving messages.
        if (acknowledgementMode >= 0) {
            template.setSessionAcknowledgeMode(acknowledgementMode);
        } else if (acknowledgementModeName != null) {
            template.setSessionAcknowledgeModeName(acknowledgementModeName);
        }
    }
    return template;
}

From source file:org.apache.camel.component.jms.JmsConfiguration.java

/**
 * Creates a {@link JmsOperations} object used for one way messaging
 *//*from  w  w w  . ja  va2  s . c  o m*/
public JmsOperations createInOnlyTemplate(JmsEndpoint endpoint, boolean pubSubDomain, String destination) {
    if (jmsOperations != null) {
        return jmsOperations;
    }

    ConnectionFactory factory = getTemplateConnectionFactory();
    JmsTemplate template = new CamelJmsTemplate(this, factory);

    template.setPubSubDomain(pubSubDomain);
    if (destinationResolver != null) {
        template.setDestinationResolver(destinationResolver);
        if (endpoint instanceof DestinationEndpoint) {
            LOG.debug(
                    "You are overloading the destinationResolver property on a DestinationEndpoint; are you sure you want to do that?");
        }
    } else if (endpoint instanceof DestinationEndpoint) {
        DestinationEndpoint destinationEndpoint = (DestinationEndpoint) endpoint;
        template.setDestinationResolver(createDestinationResolver(destinationEndpoint));
    }
    template.setDefaultDestinationName(destination);

    template.setExplicitQosEnabled(isExplicitQosEnabled());
    template.setDeliveryPersistent(deliveryPersistent);
    if (messageConverter != null) {
        template.setMessageConverter(messageConverter);
    }
    template.setMessageIdEnabled(messageIdEnabled);
    template.setMessageTimestampEnabled(messageTimestampEnabled);
    if (priority >= 0) {
        template.setPriority(priority);
    }
    template.setPubSubNoLocal(pubSubNoLocal);
    if (receiveTimeout >= 0) {
        template.setReceiveTimeout(receiveTimeout);
    }
    if (timeToLive >= 0) {
        template.setTimeToLive(timeToLive);
    }

    template.setSessionTransacted(transacted);
    if (transacted) {
        template.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
    } else {
        // This is here for completeness, but the template should not get
        // used for receiving messages.
        if (acknowledgementMode >= 0) {
            template.setSessionAcknowledgeMode(acknowledgementMode);
        } else if (acknowledgementModeName != null) {
            template.setSessionAcknowledgeModeName(acknowledgementModeName);
        }
    }
    return template;
}