Example usage for org.springframework.integration.jms.util JmsAdapterUtils SESSION_TRANSACTED

List of usage examples for org.springframework.integration.jms.util JmsAdapterUtils SESSION_TRANSACTED

Introduction

In this page you can find the example usage for org.springframework.integration.jms.util JmsAdapterUtils SESSION_TRANSACTED.

Prototype

int SESSION_TRANSACTED

To view the source code for org.springframework.integration.jms.util JmsAdapterUtils SESSION_TRANSACTED.

Click Source Link

Usage

From source file:org.springframework.integration.jms.JmsOutboundGateway.java

private void setContainerProperties(GatewayReplyListenerContainer container) {
    container.setConnectionFactory(this.connectionFactory);
    if (this.replyDestination != null) {
        container.setDestination(this.replyDestination);
    }/*w  w w. j a v a2  s .  c  o  m*/
    if (StringUtils.hasText(this.replyDestinationName)) {
        container.setDestinationName(this.replyDestinationName);
    }
    if (this.destinationResolver != null) {
        container.setDestinationResolver(this.destinationResolver);
    }
    container.setPubSubDomain(this.replyPubSubDomain);
    if (this.correlationKey != null) {
        String messageSelector = this.correlationKey + " LIKE '" + this.gatewayCorrelation + "%'";
        container.setMessageSelector(messageSelector);
    }
    container.setMessageListener(this);
    if (this.replyContainerProperties != null) {
        if (this.replyContainerProperties.isSessionTransacted() != null) {
            container.setSessionTransacted(this.replyContainerProperties.isSessionTransacted());
        }
        if (this.replyContainerProperties.getCacheLevel() != null) {
            container.setCacheLevel(this.replyContainerProperties.getCacheLevel());
        }
        if (this.replyContainerProperties.getConcurrentConsumers() != null) {
            container.setConcurrentConsumers(this.replyContainerProperties.getConcurrentConsumers());
        }
        if (this.replyContainerProperties.getIdleConsumerLimit() != null) {
            container.setIdleConsumerLimit(this.replyContainerProperties.getIdleConsumerLimit());
        }
        if (this.replyContainerProperties.getIdleTaskExecutionLimit() != null) {
            container.setIdleTaskExecutionLimit(this.replyContainerProperties.getIdleTaskExecutionLimit());
        }
        if (this.replyContainerProperties.getMaxConcurrentConsumers() != null) {
            container.setMaxConcurrentConsumers(this.replyContainerProperties.getMaxConcurrentConsumers());
        }
        if (this.replyContainerProperties.getMaxMessagesPerTask() != null) {
            container.setMaxMessagesPerTask(this.replyContainerProperties.getMaxMessagesPerTask());
        }
        if (this.replyContainerProperties.getReceiveTimeout() != null) {
            container.setReceiveTimeout(this.replyContainerProperties.getReceiveTimeout());
        }
        if (this.replyContainerProperties.getRecoveryInterval() != null) {
            container.setRecoveryInterval(this.replyContainerProperties.getRecoveryInterval());
        }
        if (StringUtils.hasText(this.replyContainerProperties.getSessionAcknowledgeModeName())) {
            Integer acknowledgeMode = JmsAdapterUtils
                    .parseAcknowledgeMode(this.replyContainerProperties.getSessionAcknowledgeModeName());
            if (acknowledgeMode != null) {
                if (JmsAdapterUtils.SESSION_TRANSACTED == acknowledgeMode) {
                    container.setSessionTransacted(true);
                } else {
                    container.setSessionAcknowledgeMode(acknowledgeMode);
                }
            }
        } else if (this.replyContainerProperties.getSessionAcknowledgeMode() != null) {
            Integer sessionAcknowledgeMode = this.replyContainerProperties.getSessionAcknowledgeMode();
            if (Session.SESSION_TRANSACTED == sessionAcknowledgeMode) {
                container.setSessionTransacted(true);
            } else {
                container.setSessionAcknowledgeMode(sessionAcknowledgeMode);
            }

        }

        if (this.replyContainerProperties.getTaskExecutor() != null) {
            container.setTaskExecutor(this.replyContainerProperties.getTaskExecutor());
        } else {
            // set the beanName so the default TE threads get a meaningful name
            String containerBeanName = this.getComponentName();
            containerBeanName = ((!StringUtils.hasText(containerBeanName)
                    ? "JMS_OutboundGateway@" + ObjectUtils.getIdentityHexString(this)
                    : containerBeanName) + ".replyListener");
            container.setBeanName(containerBeanName);
        }
    }
}