diff --git a/spring-integration-reference/src/endpoint.xml b/spring-integration-reference/src/endpoint.xml
index bd34c4758d..7a818ec111 100644
--- a/spring-integration-reference/src/endpoint.xml
+++ b/spring-integration-reference/src/endpoint.xml
@@ -80,7 +80,19 @@ PollingConsumerEndpoint endpoint = new PollingConsumerEndpoint(consumer, channel
PollingConsumerEndpoint endpoint = new PollingConsumerEndpoint(consumer, channel);
endpoint.setTrigger(new IntervalTrigger(30, TimeUnit.SECONDS));
- Likewise, other polling-related configuration properties may be specified:
+ Spring Integration currently provides two implementations of the Trigger
+ interface: IntervalTrigger and CronTrigger. The
+ IntervalTrigger is typically defined with a simple interval (in milliseconds), but
+ also supports an 'initialDelay' property and a boolean 'fixedRate' property (the default is false - i.e.
+ fixed delay):
+ IntervalTrigger trigger = new IntervalTrigger(1000);
+trigger.setInitialDelay(5000);
+trigger.setFixedRate(true);
+ The CronTrigger simply requires the cron expression (see the Javadoc for details):
+ CronTrigger trigger = new CronTrigger("*/10 * * * * MON-FRI");
+
+
+ In addition to the trigger, several other polling-related configuration properties may be specified:
PollingConsumerEndpoint endpoint = new PollingConsumerEndpoint(consumer, channel);
diff --git a/spring-integration-reference/src/event.xml b/spring-integration-reference/src/event.xml
new file mode 100644
index 0000000000..fe0ef8656c
--- /dev/null
+++ b/spring-integration-reference/src/event.xml
@@ -0,0 +1,20 @@
+
+
+
+ Spring ApplicationEvent Support
+
+ Spring Integration also provides support for inbound and outbound ApplicationEvents.
+ To receive events and send to a channel, simply define an instance of Spring Integration's
+ ApplicationEventInboundChannelAdapter. This class in an implementation of Spring's
+ ApplicationListener interface. By default it will pass all received events as
+ Spring Integration Messages. To limit based on the type of event, configure the list of event types that you want
+ to receive with the 'eventTypes' property.
+
+
+ To send Spring ApplicationEvents, create an instance of the
+ ApplicationEventPublishingMessageConsumer and register it within an endpoint. This
+ implementation of the MessageConsumer interface also implements Spring's
+ ApplicationEventPublisherAware interface and thus acts as a bridge between
+ Spring Integration Messages and ApplicationEvents.
+
+
\ No newline at end of file
diff --git a/spring-integration-reference/src/httpinvoker.xml b/spring-integration-reference/src/httpinvoker.xml
index 9f070d4534..1f90c8ff54 100644
--- a/spring-integration-reference/src/httpinvoker.xml
+++ b/spring-integration-reference/src/httpinvoker.xml
@@ -1,43 +1,99 @@
-
- HttpInvoker
+
+ HttpInvoker Support
-
+
Introduction
+ HttpInvoker is a Spring-specific remoting option that essentially enables Remote Procedure Calls (RPC) over HTTP.
+ In order to accomplish this, an outbound representation of a method invocation is serialized using standard Java
+ serialization and then passed within an HTTP POST request. After being invoked on the target system, the method's
+ return value is then serialized and written to the HTTP response. There are two main requirements. First, you
+ must be using Spring on both sides since the marshalling to and from HTTP requests and responses is handled by
+ the client-side invoker and server-side exporter. Second, the Objects that you are passing must implement
+ Serializable and be available on both the client and server.
+
+
+ While traditional RPC provides physical decoupling, it does not offer nearly the same degree
+ of logical decoupling as a messaging-based system. In other words, both participants in an
+ RPC-based invocation must be aware of a specific interface and specific argument types. Interestingly, in Spring
+ Integration, the "parameter" being sent is a Spring Integration Message, and the interface is an internal detail
+ of Spring Integration's implementation. Therefore, the RPC mechanism is being used as a
+ transport so that from the end user's perspective, it is not necessary to consider the
+ interface and argument types. It's just another adapter to enable messaging between two systems.
-
- Outbound HttpInvoker
+
+ HttpInvoker Inbound Gateway
+
+ To receive messages over http you need to use an HttpInvokerInboundGateway. Here is an
+ example bean definition:
+
+
+
+
+
+]]>
+ Because the inbound gateway must be able to receive HTTP requests, it must be configured within a Servlet
+ container. The easiest way to do this is to provide a servlet definition in web.xml:
+
+ inboundGateway
+ org.springframework.web.context.support.HttpRequestHandlerServlet
+]]>
+ Notice that the servlet name matches the bean name.
+
+ If you are running within a Spring MVC application and using the BeanNameHandlerMapping, then the servlet
+ definition is not necessary. In that case, the bean name for your gateway can be matched against the URL
+ path just like a Spring MVC Controller bean.
+
+
+
+
+
+ HttpInvoker Outbound Gateway
- To configure the outbound gateway write a bean definition like this:
-
-
+ To configure the HttpInvokerOutboundGateway write a bean definition like this:
+
+
+]]>
+ The outbound gateway is a MessageConsumer and can therefore be registered with
+ either a PollingConsumerEndpoint or SubscribingConsumerEndpoint.
+ The URL must match that defined by an inbound HttpInvoker Gateway as described in the previous section.
-
- Inbound HttpInvoker
-
- To receive messages over http you need to use a TODO. This gateway can be configured like this
-
-
-
-
-
-
- HttpInvoker namespace support
+
+ HttpInvoker Namespace Support
+
+ Spring Integration provides an "httpinvoker" namespace and schema definition. To include it in your
+ configuration, simply provide the following URI within a namespace declaration:
+ 'http://www.springframework.org/schema/integration/httpinvoker'. The schema location should then map to
+ 'http://www.springframework.org/schema/integration/httpinvoker/spring-integration-httpinvoker-1.0.xsd'.
+
To configure the inbound gateway you can choose to use the namespace support for it. The following code snippet shows the different configuration options that are supported.
-
+ ]]>
+
+ A 'reply-channel' may also be provided, but it is recommended to rely on the temporary anonymous channel
+ that will be created automatically for handling replies.
+
- To configure the outbound gateway you can use the namespace support as well. The following code snippet shows the different configuration for an outbound HttpInvoker gateway.
-
+ To configure the outbound gateway you can use the namespace support as well. The following code snippet shows the different configuration for an outbound HttpInvoker gateway. Only the 'url' and 'request-channel' are required.
+ ]]>
\ No newline at end of file
diff --git a/spring-integration-reference/src/namespaces.xml b/spring-integration-reference/src/namespaces.xml
index 9c19eb2392..4a327f6d40 100644
--- a/spring-integration-reference/src/namespaces.xml
+++ b/spring-integration-reference/src/namespaces.xml
@@ -217,12 +217,7 @@
The most convenient way to configure Source and Target adapters is by using the namespace support. The
following examples demonstrate the namespace-based configuration of several source, target, gateway,
and handler adapters:
-
-
-
-
-
-
+
diff --git a/spring-integration-reference/src/router.xml b/spring-integration-reference/src/router.xml
index 3a996619ac..956cdca619 100644
--- a/spring-integration-reference/src/router.xml
+++ b/spring-integration-reference/src/router.xml
@@ -4,6 +4,69 @@
Message Routing
+
+ Router Implementations
+
+ Since content-based routing often requires some domain-specific logic, most use-cases will require
+ Spring Integration's options for delegating to POJOs using the XML namespace support and/or Annotations.
+ Both of these are discussed below, but first we present a couple implementations that are available
+ out-of-the-box since they fulfill generic, but common, requirements.
+
+
+ PayloadTypeRouter
+
+ A PayloadTypeRouter will send Messages to the channel as defined by payload-type
+ mappings.
+
+
+
+
+]]>
+
+
+
+ RecipientListRouter
+
+ A RecipientListRouter will send each received Message to a statically-defined
+ list of Message Channels:
+
+
+
+
+
+
+
+
+]]>
+
+
+
+ The router implementations share some common properties, such as "defaultOutputChannel" and "resolutionRequired".
+ If "resolutionRequired" is set to "true", and the router is unable to determine a target channel (e.g. there is
+ no matching payload for a PayloadTypeRouter and no "defaultOutputChannel" has been specified), then an Exception
+ will be thrown.
+
+
+
+
+ The <router> element
+
+ The "router" element provides a simple way to connect a router to an input channel, and also accepts the
+ optional default output channel. The "ref" may provide the bean name to one of the implementations described
+ above:
+
+
+]]>
+ Alternatively, the "ref" may point to a simple Object that contains the @Router annotation (see below), or the
+ "ref" may be combined with an explicit "method" name. When specifying a "method", the same behavior applies as
+ described in the @Router annotation section below.
+ ]]>
+
+
+
The @Router Annotation
@@ -33,5 +96,8 @@ public List<String> route(Foo payload) {...}
public List<String> route(@Header("orderStatus") OrderStatus status)
+
+ For routing of XML-based Messages, including XPath support, see .
+
\ No newline at end of file
diff --git a/spring-integration-reference/src/spring-integration-reference.xml b/spring-integration-reference/src/spring-integration-reference.xml
index 3ebc8f2261..69f98e155d 100644
--- a/spring-integration-reference/src/spring-integration-reference.xml
+++ b/spring-integration-reference/src/spring-integration-reference.xml
@@ -52,7 +52,9 @@
-
+
+
+