diff --git a/spring-integration-reference/reference/src/core-api.xml b/spring-integration-reference/reference/src/core-api.xml index 0887bc7e46..beb4fd864f 100644 --- a/spring-integration-reference/reference/src/core-api.xml +++ b/spring-integration-reference/reference/src/core-api.xml @@ -13,6 +13,7 @@ Object getId(); MessageHeader getHeader(); T getPayload(); + boolean isExpired(); } And the header provides the following properties: @@ -39,8 +40,8 @@ java.lang.Object - replyChannelName - java.lang.String + returnAddress + java.lang.Object (can be a String or MessageChannel) sequenceNumber @@ -50,6 +51,10 @@ sequenceSize int + + priority + int + properties java.util.Properties @@ -64,11 +69,14 @@ The base implementation of the Message interface is - GenericMessage<T>, and it provides two constructors: + GenericMessage<T>, and it provides three constructors: new GenericMessage<T>(Object id, T payload); -new GenericMessage<T>(T payload); - When no id is provided, a random unique id will be generated. There are also two convenient subclasses available - currently: StringMessage and ErrorMessage. The latter accepts any +new GenericMessage<T>(T payload); +new GenericMessage<T>(T payload, MessageHeader headerToCopy) + When no id is provided, a random unique id will be generated. The constructor that accepts a + MessageHeader will copy properties, attributes, and any 'returnAddress' from the + provided header. There are also two convenient subclasses available currently: + StringMessage and ErrorMessage. The latter accepts any Throwable object as its payload. @@ -88,20 +96,35 @@ new GenericMessage<T>(T payload); While the Message plays the crucial role of encapsulating data, it is the MessageChannel that decouples message producers from message consumers. Spring Integration's MessageChannel interface is defined as follows. - public interface MessageChannel { + - The SimpleChannel implementation wraps a queue. It provides a no-argument constructor as - well as a constructor that accepts the queue capacity: - public SimpleChannel(int capacity) + List> clear(); + List> purge(MessageSelector selector); +}]]> When sending a message, the return value will be true if the message is sent successfully. If the send call times out or is interrupted, then it will return false. Likewise when receiving a message, the return value will be null in the case of a timeout or interrupt. + The SimpleChannel implementation wraps a queue. It provides a no-argument constructor as + well as a constructor that accepts the queue capacity: + public SimpleChannel(int capacity) + Specifying a capacity of 0 will create a "direct-handoff" channel where a sender will block until the channel's + receive() method is called. Otherwise a channel that has not reached its capacity limit + will store messages in its internal queue, and the send() method will return immediately + even if no receiver is ready to handle the message. + + + Whereas the SimpleChannel enforces first-in/first-out (FIFO) ordering, the + PriorityChannel is an alternative implementation that allows for messages to be ordered + within the channel based upon a priority. By default the priority is determined by the + 'priority' property within each message's header. However, for custom priority determination + logic, a comparator of type Comparator<Message<?>> can be provided to the + PriorityChannel's constructor. @@ -114,10 +137,10 @@ new GenericMessage<T>(T payload); Message<?> handle(Message<?> message); } The handler plays an important role, since it is typically responsible for translating between the generic - Message objects and the business components that consume the message payload. - That said, developers will rarely need to implement this callback directly. While that option will always be - available, we will soon discuss the higher-level configuration options including both annotation-driven - techniques and XML-based configuration with convenient namespace support. + Message objects and the domain objects or primitive values expected by business + components that consume the message payload. That said, developers will rarely need to implement this interface + directly. While that option will always be available, we will soon discuss the higher-level configuration options + including both annotation-driven techniques and XML-based configuration with convenient namespace support. @@ -139,12 +162,14 @@ new GenericMessage<T>(T payload); the following methods: public void registerChannel(String name, MessageChannel channel) public void registerHandler(String name, MessageHandler handler, Subscription subscription) -public void registerHandler(String name, MessageHandler handler, Subscription subscription, ConcurrencyPolicy concurrencyPolicy) +public void registerHandler(String name, MessageHandler handler, Subscription subscription, + ConcurrencyPolicy concurrencyPolicy) As those method signatures reveal, the message bus is handling several of the concerns here so that the channel and handler objects can be as simple as possible. These responsibilities include the creation and lifecycle management of message dispatchers, the activation of handler subscriptions, and the configuration of thread - pools. The bus coordinates all of that behavior based upon the metadata provided via these registration methods. - We will briefly take a look at each of those metadata objects. + pools. The bus coordinates all of that behavior based upon the metadata provided via these registration methods, + and typically developers will not even use this API directly since the metadata can be provided in XML and/or + annotations. We will briefly take a look at each of those metadata objects. The bus creates and manages dispatchers that pull messages from a channel in order to push those messages to @@ -162,6 +187,11 @@ public void registerHandler(String name, MessageHandler handler, Subscription su + + publishSubscribe + false + whether the dispatcher should attempt to publish to all of its handlers (rather than just one) + maxMessagesPerTask 1 @@ -221,9 +251,10 @@ public void registerHandler(String name, MessageHandler handler, Subscription su
- The scheduling metadata is provided with an instance of the Schedule interface. - This is an abstraction designed to allow extensibility of schedulers for messaging tasks. Currently, there is - a single implementation called PollingSchedule that provides the following properties: + The scheduling metadata is provided as an implementation of the Schedule + interface. This is an abstraction designed to allow extensibility of schedulers for messaging tasks. Currently, + there is a single implementation called PollingSchedule that provides the following + properties: Properties of the PollingSchedule diff --git a/spring-integration-reference/reference/src/overview.xml b/spring-integration-reference/reference/src/overview.xml index ee9d6f616b..45beb1fecf 100644 --- a/spring-integration-reference/reference/src/overview.xml +++ b/spring-integration-reference/reference/src/overview.xml @@ -121,17 +121,17 @@ Controller in the MVC paradigm. Just as a Controller handles HTTP requests, the endpoint handles Messages. Just as Controllers are mapped to URL patterns, endpoints are mapped to Message Channels. The goal is the same in both cases: isolate application code from the infrastructure. In Spring Integration, the Message Endpoint - invokes a MessageHandler callback interface as described in + "hosts" and delegates to a MessageHandler strategy interface as described in .
Message Router - A Message Router is a particular type of endpoint that is capable of receiving a Message and then deciding what - channel or channels should receive the Message next. Typically the decision is based upon the Message's content - and/or metadata. A Message Router is often used as a dynamic alternative to configuring the input and output - channels for an endpoint. + A Message Router is a particular type of MessageHandler that is capable of + receiving a Message and then deciding what channel or channels should receive the Message next. Typically the + decision is based upon the Message's content and/or metadata. A Message Router is often used as a dynamic + alternative to configuring the input and output channels for an endpoint.
@@ -141,8 +141,9 @@ Message Endpoints. These adapters provide a mechanism for connecting to external systems, such as JMS queues or a File system. Channel Adapters may be configured for input and/or output. An input (source) adapter will receive (or poll for) data, convert that data to a Message, and then send that Message to its Message Channel. - An output (target) adapter is simply another type of Message Endpoint, but when it receives a Message, it will - convert it to the target's expected type and then "send" it (publish to a JMS queue, write to a File, etc.). + An output (target) adapter is simply another type of MessageHandler, but when it + receives a Message, it will convert it to the target's expected type and then "send" it (publish to a JMS + queue, write to a File, etc.).
diff --git a/spring-integration-reference/reference/src/spring-integration-reference.xml b/spring-integration-reference/reference/src/spring-integration-reference.xml index 6b1f115f15..432a18b707 100644 --- a/spring-integration-reference/reference/src/spring-integration-reference.xml +++ b/spring-integration-reference/reference/src/spring-integration-reference.xml @@ -13,7 +13,7 @@ Spring Integration Reference Manual Spring Integration - 1.0.0.m1 (Milestone 1) + 1.0.0.m2 (Milestone 2) @@ -31,7 +31,7 @@ - Copyright © SpringSource Inc., 2007 + Copyright © SpringSource Inc., 2008