From 7f917b5dd8592c9df6f32c889339725d5f902906 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Mon, 22 Sep 2008 19:02:43 +0000 Subject: [PATCH] Removed MessageTarget. All components that referenced targets (e.g. Outbound Channel Adapter implementations) now work with the MessageConsumer interface instead. --- .../mail/SubscribableMailSource.java | 3 +- .../integration/endpoint/MessagingBridge.java | 17 ++++---- .../integration/message/MessageTarget.java | 43 ------------------- 3 files changed, 9 insertions(+), 54 deletions(-) delete mode 100644 org.springframework.integration/src/main/java/org/springframework/integration/message/MessageTarget.java diff --git a/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/SubscribableMailSource.java b/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/SubscribableMailSource.java index 72536cfbab..416e3fd302 100644 --- a/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/SubscribableMailSource.java +++ b/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/SubscribableMailSource.java @@ -28,11 +28,10 @@ import org.springframework.core.task.TaskExecutor; import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.mail.monitor.AsyncMonitoringStrategy; import org.springframework.integration.message.MessageSource; -import org.springframework.integration.message.MessageTarget; import org.springframework.util.Assert; /** - * Broadcasts all mail messages recovered to subscribed {@link MessageTarget MessageTargets}. + * An event-driven mail source that sends Spring Integration Messages to its output channel. * The given {@link FolderConnection} should be using an {@link AsyncMonitoringStrategy} to * retrieve mail. * diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java index 83c74ebe6d..d648b559d8 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java @@ -17,26 +17,25 @@ package org.springframework.integration.endpoint; import org.springframework.integration.message.Message; -import org.springframework.integration.message.MessageTarget; +import org.springframework.integration.message.MessageConsumer; import org.springframework.util.Assert; /** * @author Mark Fisher */ -public class MessagingBridge extends AbstractMessageHandlingEndpoint { +public class MessagingBridge extends AbstractMessageConsumingEndpoint { - private final MessageTarget target; + private final MessageConsumer consumer; - public MessagingBridge(MessageTarget target) { - Assert.notNull(target, "target must not be null"); - this.target = target; + public MessagingBridge(MessageConsumer consumer) { + Assert.notNull(consumer, "consumer must not be null"); + this.consumer = consumer; } @Override - protected Object handle(Message message) { - this.target.send(message); - return null; + protected void onMessageInternal(Message message) { + this.consumer.onMessage(message); } } 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 deleted file mode 100644 index c570f5570c..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageTarget.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2008 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.message; - -/** - * Interface for any target to which {@link Message Messages} can be sent. - * - * @author Mark Fisher - */ -public interface MessageTarget { - - /** - * Send a {@link Message} to this target. May throw a RuntimeException for non-recoverable - * errors. Otherwise, if the Message cannot be sent for a non-fatal reason such as timeout, - * then this method will return 'false', and if the Message is sent successfully, it will - * return 'true'. - * - * @param message the Message to send - * - * @return whether the Message has been sent successfully - * - * @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. - */ - boolean send(Message message) throws MessageRejectedException, MessageDeliveryException; - -}