INT-3384: Rework JMS/XML Module XSD Enumerations
JIRA: https://jira.spring.io/browse/INT-3384 Polishing
This commit is contained in:
@@ -22,6 +22,7 @@ import javax.jms.Destination;
|
||||
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.jms.util.JmsAdapterUtils;
|
||||
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class JmsDestinationPollingSource extends IntegrationObjectSupport implements MessageSource<Object> {
|
||||
|
||||
|
||||
private final JmsTemplate jmsTemplate;
|
||||
|
||||
private volatile Destination destination;
|
||||
@@ -50,12 +52,12 @@ public class JmsDestinationPollingSource extends IntegrationObjectSupport implem
|
||||
|
||||
private volatile JmsHeaderMapper headerMapper = new DefaultJmsHeaderMapper();
|
||||
|
||||
private volatile String sessionAcknowledgeMode;
|
||||
|
||||
public JmsDestinationPollingSource(JmsTemplate jmsTemplate) {
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
}
|
||||
|
||||
|
||||
public void setDestination(Destination destination) {
|
||||
Assert.isNull(this.destinationName, "The 'destination' and 'destinationName' properties are mutually exclusive.");
|
||||
this.destination = destination;
|
||||
@@ -84,6 +86,10 @@ public class JmsDestinationPollingSource extends IntegrationObjectSupport implem
|
||||
this.headerMapper = headerMapper;
|
||||
}
|
||||
|
||||
public void setSessionAcknowledgeMode(String sessionAcknowledgeMode) {
|
||||
this.sessionAcknowledgeMode = sessionAcknowledgeMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will receive a JMS {@link javax.jms.Message} converting and returning it as
|
||||
* a Spring Integration {@link Message}. This method will also use the current
|
||||
@@ -127,4 +133,19 @@ public class JmsDestinationPollingSource extends IntegrationObjectSupport implem
|
||||
return jmsMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
if (this.sessionAcknowledgeMode != null) {
|
||||
Integer acknowledgeMode = JmsAdapterUtils.parseAcknowledgeMode(this.sessionAcknowledgeMode);
|
||||
if (acknowledgeMode != null) {
|
||||
if (JmsAdapterUtils.SESSION_TRANSACTED == acknowledgeMode) {
|
||||
this.jmsTemplate.setSessionTransacted(true);
|
||||
}
|
||||
else {
|
||||
this.jmsTemplate.setSessionAcknowledgeMode(acknowledgeMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.jms;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.integration.context.OrderlyShutdownCapable;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.jms.util.JmsAdapterUtils;
|
||||
import org.springframework.jms.listener.AbstractMessageListenerContainer;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -35,8 +36,9 @@ public class JmsMessageDrivenEndpoint extends AbstractEndpoint implements Dispos
|
||||
private final AbstractMessageListenerContainer listenerContainer;
|
||||
|
||||
private final ChannelPublishingJmsMessageListener listener;
|
||||
|
||||
|
||||
|
||||
private volatile String sessionAcknowledgeMode;
|
||||
|
||||
public JmsMessageDrivenEndpoint(AbstractMessageListenerContainer listenerContainer,
|
||||
ChannelPublishingJmsMessageListener listener) {
|
||||
Assert.notNull(listenerContainer, "listener container must not be null");
|
||||
@@ -51,7 +53,10 @@ public class JmsMessageDrivenEndpoint extends AbstractEndpoint implements Dispos
|
||||
setPhase(Integer.MAX_VALUE / 2);
|
||||
}
|
||||
|
||||
|
||||
public void setSessionAcknowledgeMode(String sessionAcknowledgeMode) {
|
||||
this.sessionAcknowledgeMode = sessionAcknowledgeMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "jms:message-driven-channel-adapter";
|
||||
@@ -63,6 +68,15 @@ public class JmsMessageDrivenEndpoint extends AbstractEndpoint implements Dispos
|
||||
if (!this.listenerContainer.isActive()) {
|
||||
this.listenerContainer.afterPropertiesSet();
|
||||
}
|
||||
Integer acknowledgeMode = JmsAdapterUtils.parseAcknowledgeMode(this.sessionAcknowledgeMode);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode.intValue() == JmsAdapterUtils.SESSION_TRANSACTED) {
|
||||
this.listenerContainer.setSessionTransacted(true);
|
||||
}
|
||||
else {
|
||||
this.listenerContainer.setSessionAcknowledgeMode(acknowledgeMode);
|
||||
}
|
||||
}
|
||||
listener.setComponentName(this.getComponentName());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.MessageTimeoutException;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
|
||||
import org.springframework.integration.jms.util.JmsAdapterUtils;
|
||||
import org.springframework.jms.connection.ConnectionFactoryUtils;
|
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer;
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
@@ -593,9 +594,28 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
if (this.replyContainerProperties.getRecoveryInterval() != null) {
|
||||
container.setRecoveryInterval(this.replyContainerProperties.getRecoveryInterval());
|
||||
}
|
||||
if (this.replyContainerProperties.getSessionAcknowledgeMode() != null) {
|
||||
container.setSessionAcknowledgeMode(this.replyContainerProperties.getSessionAcknowledgeMode());
|
||||
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());
|
||||
}
|
||||
@@ -610,6 +630,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
synchronized (this.lifeCycleMonitor) {
|
||||
@@ -1209,11 +1230,12 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
}
|
||||
|
||||
public static class ReplyContainerProperties {
|
||||
|
||||
private volatile Boolean sessionTransacted;
|
||||
|
||||
private volatile Integer sessionAcknowledgeMode;
|
||||
|
||||
private volatile String sessionAcknowledgeModeName;
|
||||
|
||||
private volatile Long receiveTimeout;
|
||||
|
||||
private volatile Long recoveryInterval;
|
||||
@@ -1232,6 +1254,14 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
|
||||
private volatile Executor taskExecutor;
|
||||
|
||||
public String getSessionAcknowledgeModeName() {
|
||||
return sessionAcknowledgeModeName;
|
||||
}
|
||||
|
||||
public void setSessionAcknowledgeModeName(String sessionAcknowledgeModeName) {
|
||||
this.sessionAcknowledgeModeName = sessionAcknowledgeModeName;
|
||||
}
|
||||
|
||||
public Boolean isSessionTransacted() {
|
||||
return sessionTransacted;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.integration.jms.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
@@ -68,21 +67,6 @@ abstract class JmsAdapterParserUtils {
|
||||
"receive-timeout", "session-transacted"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The following constants match those of javax.jms.Session.
|
||||
* They are duplicated here to avoid a dependency in tooling.
|
||||
*/
|
||||
|
||||
static final int SESSION_TRANSACTED = 0;
|
||||
|
||||
private static final int AUTO_ACKNOWLEDGE = 1;
|
||||
|
||||
private static final int CLIENT_ACKNOWLEDGE = 2;
|
||||
|
||||
private static final int DUPS_OK_ACKNOWLEDGE = 3;
|
||||
|
||||
|
||||
static String determineConnectionFactoryBeanName(Element element, ParserContext parserContext) {
|
||||
String connectionFactoryBeanName = "connectionFactory";
|
||||
if (element.hasAttribute(CONNECTION_FACTORY_ATTRIBUTE)) {
|
||||
@@ -95,30 +79,6 @@ abstract class JmsAdapterParserUtils {
|
||||
return connectionFactoryBeanName;
|
||||
}
|
||||
|
||||
static Integer parseAcknowledgeMode(Element element, ParserContext parserContext) {
|
||||
String acknowledge = element.getAttribute("acknowledge");
|
||||
if (StringUtils.hasText(acknowledge)) {
|
||||
int acknowledgeMode = AUTO_ACKNOWLEDGE;
|
||||
if ("transacted".equals(acknowledge)) {
|
||||
acknowledgeMode = SESSION_TRANSACTED;
|
||||
}
|
||||
else if ("dups-ok".equals(acknowledge)) {
|
||||
acknowledgeMode = DUPS_OK_ACKNOWLEDGE;
|
||||
}
|
||||
else if ("client".equals(acknowledge)) {
|
||||
acknowledgeMode = CLIENT_ACKNOWLEDGE;
|
||||
}
|
||||
else if (!"auto".equals(acknowledge)) {
|
||||
parserContext.getReaderContext().error("Invalid JMS 'acknowledge' setting: " +
|
||||
"only \"auto\", \"client\", \"dups-ok\" and \"transacted\" supported.", element);
|
||||
}
|
||||
return acknowledgeMode;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static BeanDefinition parseJmsTemplateBeanDefinition(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DynamicJmsTemplate.class);
|
||||
builder.addPropertyReference(JmsAdapterParserUtils.CONNECTION_FACTORY_PROPERTY,
|
||||
@@ -137,17 +97,7 @@ abstract class JmsAdapterParserUtils {
|
||||
else {
|
||||
builder.addPropertyValue("receiveTimeout", JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT);
|
||||
}
|
||||
Integer acknowledgeMode = parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode == SESSION_TRANSACTED) {
|
||||
parserContext.getReaderContext().error(
|
||||
"'transacted' is not a valid 'acknowledge-mode' here, use 'session-transacted'" +
|
||||
" to enable transactions", element);
|
||||
}
|
||||
builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "session-transacted");
|
||||
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public class JmsInboundChannelAdapterParser extends AbstractPollingInboundChanne
|
||||
else {
|
||||
builder.addConstructorArgValue(JmsAdapterParserUtils.parseJmsTemplateBeanDefinition(element, parserContext));
|
||||
}
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeMode");
|
||||
if (hasDestinationRef || hasDestinationName) {
|
||||
if (hasDestinationRef) {
|
||||
if (hasDestinationName) {
|
||||
|
||||
@@ -116,6 +116,8 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
builder.addConstructorArgReference(listenerBeanName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.AUTO_STARTUP);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.PHASE);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeMode");
|
||||
|
||||
}
|
||||
|
||||
private String parseMessageListenerContainer(Element element, ParserContext parserContext) {
|
||||
@@ -161,15 +163,7 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
builder.addPropertyValue("destinationName", destinationName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, pubSubDomainAttribute, "pubSubDomain");
|
||||
}
|
||||
Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode.intValue() == JmsAdapterParserUtils.SESSION_TRANSACTED) {
|
||||
builder.addPropertyValue("sessionTransacted", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
}
|
||||
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "destination-resolver");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "transaction-manager");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor");
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.integration.jms.JmsOutboundGateway;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -73,6 +72,7 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
builder.addPropertyValue("deliveryPersistent", deliveryPersistent);
|
||||
}
|
||||
Element container = DomUtils.getChildElementByTagName(element, "reply-listener");
|
||||
|
||||
if (container != null) {
|
||||
this.parseReplyContainer(builder, parserContext, container);
|
||||
}
|
||||
@@ -119,15 +119,7 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
private void parseReplyContainer(BeanDefinitionBuilder gatewayBuilder, ParserContext parserContext, Element element) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JmsOutboundGateway.ReplyContainerProperties.class);
|
||||
Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (JmsAdapterParserUtils.SESSION_TRANSACTED == acknowledgeMode) {
|
||||
builder.addPropertyValue("sessionTransacted", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
}
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeModeName");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-messages-per-task");
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.jms.util;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Liujiong
|
||||
* @since 4.1
|
||||
*
|
||||
*/
|
||||
public abstract class JmsAdapterUtils {
|
||||
|
||||
public static final int SESSION_TRANSACTED = 0;
|
||||
|
||||
public static final int AUTO_ACKNOWLEDGE = 1;
|
||||
|
||||
public static final int CLIENT_ACKNOWLEDGE = 2;
|
||||
|
||||
public static final int DUPS_OK_ACKNOWLEDGE = 3;
|
||||
|
||||
public static Integer parseAcknowledgeMode(String acknowledge) {
|
||||
if (StringUtils.hasText(acknowledge)) {
|
||||
int acknowledgeMode = AUTO_ACKNOWLEDGE;
|
||||
if ("transacted".equals(acknowledge)) {
|
||||
acknowledgeMode = SESSION_TRANSACTED;
|
||||
}
|
||||
else if ("dups-ok".equals(acknowledge)) {
|
||||
acknowledgeMode = DUPS_OK_ACKNOWLEDGE;
|
||||
}
|
||||
else if ("client".equals(acknowledge)) {
|
||||
acknowledgeMode = CLIENT_ACKNOWLEDGE;
|
||||
}
|
||||
else if (!"auto".equals(acknowledge)) {
|
||||
throw new IllegalStateException("Invalid JMS 'acknowledge' setting: " +
|
||||
"only \"auto\", \"client\", \"dups-ok\" and \"transacted\" supported.");
|
||||
}
|
||||
return acknowledgeMode;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,10 +170,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="default"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="listenerContainerEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="container-class" type="xsd:string">
|
||||
@@ -264,13 +261,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="connection"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="consumer"/>
|
||||
<xsd:enumeration value="auto"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="cacheLevelEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="acknowledge" default="transacted">
|
||||
@@ -283,12 +274,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="jsmAcknowledgeModeEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="transaction-manager" type="xsd:string">
|
||||
@@ -755,12 +741,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="jsmAcknowledgeModeEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attributeGroup ref="dmlcAttributeGroup" />
|
||||
@@ -1269,12 +1250,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="jsmAcknowledgeModeEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="selector" type="xsd:string">
|
||||
@@ -1502,5 +1478,31 @@
|
||||
</xsd:attribute>
|
||||
|
||||
</xsd:attributeGroup>
|
||||
|
||||
|
||||
<xsd:simpleType name="cacheLevelEnumeration">
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="connection"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="consumer"/>
|
||||
<xsd:enumeration value="auto"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="listenerContainerEnumeration">
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="default"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="jsmAcknowledgeModeEnumeration">
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
@@ -3,13 +3,23 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="jmsAcknowledgeModeTransacted">transacted</prop>
|
||||
</util:properties>
|
||||
|
||||
<int-jms:inbound-channel-adapter channel="out" session-transacted="true"
|
||||
connection-factory="connectionFactory" destination-name="incatQ"
|
||||
receive-timeout="500">
|
||||
receive-timeout="500" acknowledge="${jmsAcknowledgeModeTransacted}">
|
||||
<int:poller fixed-delay="500"/>
|
||||
</int-jms:inbound-channel-adapter>
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<int:channel id="receiveChannel">
|
||||
<int:queue/>
|
||||
|
||||
@@ -3,16 +3,28 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="CACHELEVEL">none</prop>
|
||||
<prop key="listenerContainer">simple</prop>
|
||||
<prop key="jsmAcknowledgeMode">auto</prop>
|
||||
</util:properties>
|
||||
|
||||
<int:channel-interceptor pattern="jmsChannel">
|
||||
<bean class="org.springframework.integration.jms.config.GlobalChannelInterceptorTests.SampleInterceptor"/>
|
||||
</int:channel-interceptor>
|
||||
|
||||
<int-jms:channel id="jmsChannel" queue="jmsQueue"/>
|
||||
|
||||
<int-jms:channel id="jmsChannel" cache="${CACHELEVEL}" queue="jmsQueue" container-type="${listenerContainer}"/>
|
||||
|
||||
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||||
<property name="targetConnectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
|
||||
@@ -4,15 +4,26 @@
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/task
|
||||
http://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="jmsAcknowledgeModeTransacted">transacted</prop>
|
||||
<prop key="jmsAcknowledgeModeDupsOk">dups-ok</prop>
|
||||
</util:properties>
|
||||
|
||||
<si:channel id="requestChannel"/>
|
||||
|
||||
<jms:outbound-gateway id="jmsGateway"
|
||||
@@ -21,7 +32,7 @@
|
||||
delivery-persistent="true"
|
||||
auto-startup="false">
|
||||
<jms:reply-listener
|
||||
acknowledge="transacted"
|
||||
acknowledge="${jmsAcknowledgeModeTransacted}"
|
||||
concurrent-consumers="4"
|
||||
max-concurrent-consumers="5"
|
||||
max-messages-per-task="10"
|
||||
@@ -53,7 +64,7 @@
|
||||
<bean class="org.springframework.integration.jms.config.JmsOutboundGatewayParserTests$FooAdvice" />
|
||||
</jms:request-handler-advice-chain>
|
||||
<jms:reply-listener
|
||||
acknowledge="dups-ok"
|
||||
acknowledge="${jmsAcknowledgeModeDupsOk}"
|
||||
concurrent-consumers="3"
|
||||
max-concurrent-consumers="5"
|
||||
max-messages-per-task="10"
|
||||
|
||||
Reference in New Issue
Block a user