Merge pull request #22 from markfisher/INT-1996

inbound-gateway now supports all attributes
This commit is contained in:
Mark Fisher
2011-08-19 14:37:21 -04:00
5 changed files with 281 additions and 306 deletions

View File

@@ -100,6 +100,7 @@ abstract class AbstractAmqpInboundAdapterParser extends AbstractSingleBeanDefini
}
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converter");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "header-mapper");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel");
this.configureChannels(element, parserContext, builder);
}

View File

@@ -38,7 +38,6 @@ public class AmqpInboundChannelAdapterParser extends AbstractAmqpInboundAdapterP
@Override
protected void configureChannels(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "channel", "outputChannel");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel");
}
}

View File

@@ -84,251 +84,22 @@
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Unique ID for this adapter.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="acknowledge-mode">
<xsd:annotation>
<xsd:documentation>
Acknowledge Mode for the MessageListenerContainer.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AUTO"/>
<xsd:enumeration value="MANUAL"/>
<xsd:enumeration value="NONE"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="advice-chain" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="java.util.Collection" />
</tool:annotation>
<xsd:documentation>
Array of AOP Advice instances to be applied to the MessageListener.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<xsd:complexContent>
<xsd:extension base="inboundType">
<xsd:attribute name="channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Message Channel to which converted Messages should be sent.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="channel-transacted" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Flag to indicate that channels created by this component will be transactional.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="concurrent-consumers" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specify the number of concurrent consumers to create. Default is 1.
Raising the number of concurrent consumers is recommended in order to scale the consumption of messages coming in
from a queue. However, note that any ordering guarantees are lost once multiple consumers are registered. In
general, stick with 1 consumer for low-volume queues.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="connection-factory" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.connection.ConnectionFactory"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="error-channel" use="optional" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Message Channel to which error Messages should be sent.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expose-listener-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
Set whether to expose the listener Rabbit Channel to a registered ChannelAwareMessageListener as well as
to RabbitTemplate calls.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="header-mapper" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
HeaderMapper to use when receiving AMQP Messages.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.amqp.support.AmqpHeaderMapper"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="listener-container" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Reference to the MessageListener container to use for receiving AMQP Messages. If this attribute is provided,
then no other attribute related to the listener container configuration should be provided. In other words, by
setting this reference, you must take full responsibility of the listener container configuration. The only
exception is the MessageListener itself. Since that is actually the core responsibility of this Channel Adapter
implementation, the referenced listener container must NOT already have its own MessageListener configured.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="message-converter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
MessageConverter to use when receiving AMQP Messages.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.support.converter.MessageConverter"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="message-properties-converter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
MessagePropertiesConverter to use when receiving AMQP Messages.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.support.MessagePropertiesConverter"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="phase" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The lifeycle phase determining the start/stop order of the underlying listener container.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="prefetch-count" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
Specifies how many messages to send to each consumer in a single request. Often this can be set quite high
to improve throughput. It should be greater than or equal to the tx-size value.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="queue-names" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation>
Names of the AMQP Queues from which Messages should be consumed (comma-separated list).
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="receive-timeout" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The timeout for each attempt by a consumer to receive the next message.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="recovery-interval" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The interval between recovery attempts, in milliseconds. The default is 5000 ms, that is, 5 seconds.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="shutdown-timeout" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The time to wait for workers in milliseconds after the container is stopped, and before the connection is forced closed.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="tx-size" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
How many messages to process in a single transaction (if the channel is transactional). For best results it should be
less than or equal to the prefetch count.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="task-executor" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
Reference to the Executor to be used for running Consumer threads.
</xsd:documentation>
<tool:annotation kind="ref">
<tool:expected-type type="java.util.concurrent.Executor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="transaction-attribute" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The TransactionAttribute to use when the Consumer receives the AMQP Message and the Listener is invoked
within a transaction. This is only applicable when a TransactionManager has been configured.
</xsd:documentation>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.transaction.interceptor.TransactionAttribute"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="transaction-manager" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The PlatformTransactionManager to use when the Consumer receives the AMQP Message and the Listener is invoked.
</xsd:documentation>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.transaction.PlatformTransactionManager"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
@@ -421,73 +192,276 @@
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Unique ID for this adapter.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="request-channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<xsd:complexContent>
<xsd:extension base="inboundType">
<xsd:attribute name="request-channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Message Channel to which converted Messages should be sent.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-channel" use="optional" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-channel" use="optional" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Message Channel where reply Messages will be expected.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="queue-names" type="xsd:string" use="required">
<xsd:annotation>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="inboundType">
<xsd:annotation>
<xsd:documentation>
Base type for the 'inbound-channel-adapter' and 'inbound-gateway' elements.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Unique ID for this adapter.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="acknowledge-mode">
<xsd:annotation>
<xsd:documentation>
Acknowledge Mode for the MessageListenerContainer.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AUTO"/>
<xsd:enumeration value="MANUAL"/>
<xsd:enumeration value="NONE"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="advice-chain" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="java.util.Collection" />
</tool:annotation>
<xsd:documentation>
Names of the AMQP Queues from which Messages should be consumed (comma-separated list).
Array of AOP Advice instances to be applied to the MessageListener.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="concurrent-consumers" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="channel-transacted" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Flag to indicate that AMQP channels created by this component will be transactional.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="concurrent-consumers" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specify the number of concurrent consumers to create. Default is 1.
Raising the number of concurrent consumers is recommended in order to scale the consumption of messages coming in
from a queue. However, note that any ordering guarantees are lost once multiple consumers are registered. In
general, stick with 1 consumer for low-volume queues.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="connection-factory" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.connection.ConnectionFactory"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="error-channel" use="optional" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Message Channel to which error Messages should be sent.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expose-listener-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
Set whether to expose the listener Rabbit Channel to a registered ChannelAwareMessageListener as well as
to RabbitTemplate calls.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="advice-chain" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="java.util.Collection"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="connection-factory" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.connection.ConnectionFactory"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="header-mapper" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
HeaderMapper to use when receiving AMQP Messages.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.amqp.support.AmqpHeaderMapper"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="listener-container" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Reference to the MessageListener container to use for receiving AMQP Messages. If this attribute is provided,
then no other attribute related to the listener container configuration should be provided. In other words, by
setting this reference, you must take full responsibility of the listener container configuration. The only
exception is the MessageListener itself. Since that is actually the core responsibility of this Channel Adapter
implementation, the referenced listener container must NOT already have its own MessageListener configured.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="message-converter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
MessageConverter to use when receiving AMQP Messages.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.support.converter.MessageConverter"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="message-properties-converter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
MessagePropertiesConverter to use when receiving AMQP Messages.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.amqp.rabbit.support.MessagePropertiesConverter"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="phase" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The lifeycle phase determining the start/stop order of the underlying listener container.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="prefetch-count" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
Specifies how many messages to send to each consumer in a single request. Often this can be set quite high
to improve throughput. It should be greater than or equal to the tx-size value.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="queue-names" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation>
Names of the AMQP Queues from which Messages should be consumed (comma-separated list).
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="receive-timeout" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The timeout for each attempt by a consumer to receive the next message.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="recovery-interval" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The interval between recovery attempts, in milliseconds. The default is 5000 ms, that is, 5 seconds.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="shutdown-timeout" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The time to wait for workers in milliseconds after the container is stopped, and before the connection is forced closed.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="tx-size" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
How many messages to process in a single transaction (if the channel is transactional). For best results it should be
less than or equal to the prefetch count.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="task-executor" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
Reference to the Executor to be used for running Consumer threads.
</xsd:documentation>
<tool:annotation kind="ref">
<tool:expected-type type="java.util.concurrent.Executor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="transaction-attribute" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The TransactionAttribute to use when the Consumer receives the AMQP Message and the Listener is invoked
within a transaction. This is only applicable when a TransactionManager has been configured.
</xsd:documentation>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.transaction.interceptor.TransactionAttribute"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="transaction-manager" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<xsd:documentation>
The PlatformTransactionManager to use when the Consumer receives the AMQP Message and the Listener is invoked.
</xsd:documentation>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.transaction.PlatformTransactionManager"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:schema>

View File

@@ -3,7 +3,7 @@
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:console="http://www.springframework.org/schema/integration/stream" xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
@@ -27,7 +27,7 @@
queue-names="si.test.queue"
connection-factory="connectionFactory" />
<logging-channel-adapter id="fromRabbit" log-full-message="true"/>
<logging-channel-adapter id="fromRabbit" log-full-message="true" logger-name="test.logger"/>
<!-- <console:stdout-channel-adapter id="fromRabbit" append-newline="true" /> -->
<!-- Infrastructure -->

View File

@@ -4,6 +4,7 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.category.test=DEBUG
log4j.category.org.springframework=WARN
log4j.category.org.springframework.amqp=WARN
log4j.category.org.springframework.integration.amqp=WARN