-
-
- Defines a channel that buffers messages in a queue.
-
-
+
+
+
+
+ Defines a bounded queue for messages.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Defines a queue with priority-ordering for message reception.
+
+
+
+
+
+
+
+
+
+
+
+ Defines a rendezvous queue where a sender will block until the receiver arrives or vice-versa.
+
+
+
- Defines a publish-subscribe channel that broadcasts to its targets.
+ Defines a Publish-Subscribe channel that broadcasts messages to its subscribers.
+
+
+
@@ -80,55 +134,14 @@
-
-
-
- Defines a channel that invokes its handlers directly in the sender's thread.
-
-
-
-
-
-
-
-
- Defines a channel with priority-ordering for message reception.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Defines a channel with a configurable capacity.
-
-
-
-
-
-
-
-
-
Defines a message channel.
-
-
-
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/SimpleDispatcher.java b/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/SimpleDispatcher.java
index f08ed70b17..4f6517af98 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/SimpleDispatcher.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/SimpleDispatcher.java
@@ -17,6 +17,7 @@
package org.springframework.integration.dispatcher;
import org.springframework.integration.message.Message;
+import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.integration.message.MessageTarget;
@@ -25,9 +26,10 @@ import org.springframework.integration.message.MessageTarget;
* to send a {@link Message} to one of its targets. As soon as one
* of the targets accepts the Message, the dispatcher will return 'true'.
*
- * If all targets reject the Message, the dispatcher will throw a
- * MessageRejectedException. If all targets return 'false' (e.g. due
- * to a timeout), the dispatcher will return 'false'.
+ * If the dispatcher has no targets, a {@link MessageDeliveryException}
+ * will be thrown. If all targets reject the Message, the dispatcher will
+ * throw a MessageRejectedException. If all targets return 'false'
+ * (e.g. due to a timeout), the dispatcher will return 'false'.
*
* @author Mark Fisher
*/
@@ -35,10 +37,7 @@ public class SimpleDispatcher extends AbstractDispatcher {
public boolean send(Message> message) {
if (this.targets.size() == 0) {
- if (logger.isWarnEnabled()) {
- logger.warn("Dispatcher has no targets.");
- }
- return false;
+ throw new MessageDeliveryException(message, "Dispatcher has no targets.");
}
int count = 0;
int rejectedExceptionCount = 0;
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageTarget.java b/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageTarget.java
index aecf0293c2..c570f5570c 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageTarget.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageTarget.java
@@ -36,7 +36,7 @@ public interface MessageTarget {
* @throws MessageRejectedException if this particular Message is not accepted by the target
* (e.g. after consulting a {@link org.springframework.integration.message.selector.MessageSelector})
* @throws MessageDeliveryException if this target is unable to send the Message due
- * to a transport error
+ * to a transport error.
*/
boolean send(Message> message) throws MessageRejectedException, MessageDeliveryException;
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java
index 99bcfee86b..63f681add3 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java
@@ -26,10 +26,10 @@ import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.FatalBeanException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.PublishSubscribeChannel;
-import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.TestChannelInterceptor;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
@@ -61,13 +61,11 @@ public class ChannelParserTests {
}
@Test
- public void testQueueChannelByDefault() throws InterruptedException {
+ public void testDirectChannelByDefault() throws InterruptedException {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"channelParserTests.xml", this.getClass());
- MessageChannel channel = (MessageChannel) context.getBean("queueChannelByDefault");
- //called to initialize the channel instance
- channel.getName();
- assertEquals(QueueChannel.class, channel.getClass());
+ MessageChannel channel = (MessageChannel) context.getBean("defaultChannel");
+ assertEquals(DirectChannel.class, channel.getClass());
}
@Test
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelInterceptorParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelInterceptorParserTests.xml
index 2f8ac81685..adb98e7f93 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelInterceptorParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelInterceptorParserTests.xml
@@ -8,12 +8,14 @@
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelParserTests.xml
index 0ea9adaf92..2114fdf39b 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/channelParserTests.xml
@@ -7,20 +7,28 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
-
+
+
+
-
+
-
+
+
+
-
+
+
+
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/priorityChannelParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/priorityChannelParserTests.xml
index b0ea565add..b7904bbdc1 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/priorityChannelParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/priorityChannelParserTests.xml
@@ -7,11 +7,17 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
-
+
+
+
-
+
+
+
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/rendezvousChannelParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/rendezvousChannelParserTests.xml
index 8b6b8cd0f3..b3799ca512 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/rendezvousChannelParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/rendezvousChannelParserTests.xml
@@ -7,6 +7,8 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/directChannelParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/directChannelParserTests.xml
index 726c248263..b4eac91aba 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/directChannelParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/channel/directChannelParserTests.xml
@@ -7,6 +7,6 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml
index a7b7ebbedb..7f45366daa 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml
@@ -9,7 +9,9 @@
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/EndpointInterceptorTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/config/EndpointInterceptorTests.java
index fec4f3a1a0..5becb32976 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/EndpointInterceptorTests.java
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/EndpointInterceptorTests.java
@@ -17,6 +17,7 @@
package org.springframework.integration.config;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.List;
@@ -24,6 +25,7 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.endpoint.EndpointInterceptor;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.message.StringMessage;
@@ -52,21 +54,24 @@ public class EndpointInterceptorTests {
@SuppressWarnings("unchecked")
private static void testInterceptors(MessageEndpoint endpoint, ClassPathXmlApplicationContext context, boolean innerBeans) {
+ MessageChannel channel = null;
TestPreHandleInterceptor preInterceptor = null;
TestPostHandleInterceptor postInterceptor = null;
if (innerBeans) {
+ channel = (MessageChannel) context.getBean("inputChannelForBeans");
DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint);
List interceptors = (List) accessor.getPropertyValue("interceptors");
preInterceptor = (TestPreHandleInterceptor) interceptors.get(0);
postInterceptor = (TestPostHandleInterceptor) interceptors.get(1);
}
else {
+ channel = (MessageChannel) context.getBean("inputChannelForRefs");
preInterceptor = (TestPreHandleInterceptor) context.getBean("preInterceptor");
postInterceptor = (TestPostHandleInterceptor) context.getBean("postInterceptor");
}
assertEquals(0, preInterceptor.getCount());
assertEquals(0, postInterceptor.getCount());
- endpoint.send(new StringMessage("test"));
+ assertTrue(channel.send(new StringMessage("test")));
assertEquals(1, preInterceptor.getCount());
assertEquals(1, postInterceptor.getCount());
context.stop();
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/aggregatorParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/aggregatorParserTests.xml
index 7f48e2764c..f984257e3c 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/aggregatorParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/aggregatorParserTests.xml
@@ -10,8 +10,12 @@
-
-
+
+
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml
index 2116d70e45..350cba9459 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml
@@ -10,7 +10,10 @@
-
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/messageParameterAnnotatedEndpointTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/messageParameterAnnotatedEndpointTests.xml
index 967694cf50..1006ae307b 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/messageParameterAnnotatedEndpointTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/messageParameterAnnotatedEndpointTests.xml
@@ -13,7 +13,9 @@
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/simpleAnnotatedEndpointTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/simpleAnnotatedEndpointTests.xml
index ffcaa5a736..34bc5e3546 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/simpleAnnotatedEndpointTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/simpleAnnotatedEndpointTests.xml
@@ -13,7 +13,9 @@
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/typeConvertingEndpointTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/typeConvertingEndpointTests.xml
index 16b6b156f3..aeac23e091 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/typeConvertingEndpointTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/typeConvertingEndpointTests.xml
@@ -11,7 +11,9 @@
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointInterceptorTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointInterceptorTests.xml
index f3c32e6e78..c8d57a0a63 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointInterceptorTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointInterceptorTests.xml
@@ -7,17 +7,18 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
-
+
-
-
-
+
+
+
+
+
-
+ output-channel="outputChannel">
@@ -25,10 +26,9 @@
-
+ output-channel="outputChannel">
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithErrorHandler.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithErrorHandler.xml
index 2ee5ff3aa6..dca0e59afa 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithErrorHandler.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithErrorHandler.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml
index 4f269ddb4c..a5282e4693 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml
@@ -9,9 +9,13 @@
-
+
+
+
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml
index 8bcdc28bab..c483be32a4 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml
@@ -9,7 +9,9 @@
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml
index e104181840..c11ef8e20d 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml
@@ -9,7 +9,9 @@
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/resequencerParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/resequencerParserTests.xml
index 1ca55033e6..748f10e525 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/resequencerParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/resequencerParserTests.xml
@@ -8,11 +8,15 @@
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/wireTapParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/wireTapParserTests.xml
index b2b3045d5a..856de32581 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/wireTapParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/wireTapParserTests.xml
@@ -8,24 +8,28 @@
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/SimpleDispatcherTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/SimpleDispatcherTests.java
index cafac78cf1..ce9e00845a 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/SimpleDispatcherTests.java
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/SimpleDispatcherTests.java
@@ -30,6 +30,7 @@ import org.springframework.integration.endpoint.DefaultEndpoint;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.handler.TestHandlers;
import org.springframework.integration.message.Message;
+import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.integration.message.MessageTarget;
import org.springframework.integration.message.StringMessage;
@@ -108,9 +109,18 @@ public class SimpleDispatcherTests {
dispatcher.unsubscribe(target1);
dispatcher.send(new StringMessage("test3"));
assertEquals(6, counter.get());
- dispatcher.unsubscribe(target3);
- dispatcher.send(new StringMessage("test4"));
- assertEquals(6, counter.get());
+ }
+
+ @Test(expected = MessageDeliveryException.class)
+ public void unsubscribeLastTargetCausesDeliveryException() {
+ SimpleDispatcher dispatcher = new SimpleDispatcher();
+ final AtomicInteger counter = new AtomicInteger();
+ MessageTarget target = new CountingTestTarget(counter, false);
+ dispatcher.subscribe(target);
+ dispatcher.send(new StringMessage("test1"));
+ assertEquals(1, counter.get());
+ dispatcher.unsubscribe(target);
+ dispatcher.send(new StringMessage("test2"));
}
@Test
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/propagationMandatoryTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/propagationMandatoryTests.xml
index 893d15b4d9..8f2fa7f1df 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/propagationMandatoryTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/dispatcher/propagationMandatoryTests.xml
@@ -9,9 +9,17 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml
index a161de0042..16c88866b8 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml
@@ -10,18 +10,30 @@
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/gateway/config/gatewayParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/gateway/config/gatewayParserTests.xml
index a533214a85..f39e195986 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/gateway/config/gatewayParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/gateway/config/gatewayParserTests.xml
@@ -9,9 +9,13 @@
-
+
+
+
-
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml
index 787c4741d6..739748c331 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml
@@ -11,9 +11,13 @@
-
+
+
+
-
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterAggregatorTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterAggregatorTests.xml
index c6f7b7ea09..5026227843 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterAggregatorTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterAggregatorTests.xml
@@ -9,9 +9,11 @@
-
-
-
+
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml
index ca2a276054..cc195adfa5 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml
@@ -11,7 +11,9 @@
-
+
+
+