Removed SourceEndpoint. Also, MessageExchangeTemplate now wraps any Exception thrown in source.receive() in a MessagingException.
This commit is contained in:
@@ -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() + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user