Removed SourceEndpoint. Also, MessageExchangeTemplate now wraps any Exception thrown in source.receive() in a MessagingException.

This commit is contained in:
Mark Fisher
2008-08-05 21:11:43 +00:00
parent 8274dfc428
commit 1e82a8d568
3 changed files with 22 additions and 60 deletions

View File

@@ -1,46 +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.endpoint;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.message.MessageSource;
import org.springframework.util.Assert;
/**
* A channel adapter that retrieves messages from a {@link MessageSource}
* and then sends the resulting messages to the provided {@link MessageChannel}.
*
* @author Mark Fisher
*/
public class SourceEndpoint extends AbstractEndpoint {
public SourceEndpoint(MessageSource<?> source) {
Assert.notNull(source, "source must not be null");
this.setSource(source);
}
@Override
public void initialize() {
if (this.getTarget() == null) {
throw new ConfigurationException(
"no output has been configured for source endpoint '" + this.getName() + "'");
}
}
}

View File

@@ -223,11 +223,11 @@ public class MessageExchangeTemplate implements InitializingBean {
}
private boolean doReceiveAndForward(PollableSource<?> source, MessageTarget target) {
Message<?> message = this.doReceive(source);
if (message == null) {
return false;
}
try {
Message<?> message = this.doReceive(source);
if (message == null) {
return false;
}
boolean sent = this.doSend(message, target);
if (source instanceof MessageDeliveryAware) {
if (sent) {