Removed the PollableSource interface, and migrated the 'receive()' method to MessageSource.
This commit is contained in:
@@ -21,8 +21,8 @@ import org.springframework.integration.message.BlockingSource;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageDeliveryAware;
|
||||
import org.springframework.integration.message.MessageDeliveryException;
|
||||
import org.springframework.integration.message.MessageSource;
|
||||
import org.springframework.integration.message.MessagingException;
|
||||
import org.springframework.integration.message.PollableSource;
|
||||
import org.springframework.integration.scheduling.Trigger;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -31,14 +31,14 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SourcePoller extends AbstractPoller {
|
||||
|
||||
private final PollableSource<?> source;
|
||||
private final MessageSource<?> source;
|
||||
|
||||
private final MessageChannel channel;
|
||||
|
||||
private volatile long receiveTimeout = 1000;
|
||||
|
||||
|
||||
public SourcePoller(PollableSource<?> source, MessageChannel channel, Trigger trigger) {
|
||||
public SourcePoller(MessageSource<?> source, MessageChannel channel, Trigger trigger) {
|
||||
super(trigger);
|
||||
Assert.notNull(source, "source must not be null");
|
||||
Assert.notNull(channel, "channel must not be null");
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.message.MessageSource;
|
||||
import org.springframework.integration.message.MethodInvokingSource;
|
||||
import org.springframework.integration.message.PollableSource;
|
||||
import org.springframework.integration.scheduling.TaskScheduler;
|
||||
import org.springframework.integration.scheduling.Trigger;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.integration.scheduling.Trigger;
|
||||
*/
|
||||
public class SourcePollingChannelAdapter extends AbstractMessageProducingEndpoint implements Lifecycle {
|
||||
|
||||
private volatile PollableSource<?> source;
|
||||
private volatile MessageSource<?> source;
|
||||
|
||||
private volatile Trigger trigger;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SourcePollingChannelAdapter extends AbstractMessageProducingEndpoin
|
||||
private final Object lifecycleMonitor = new Object();
|
||||
|
||||
|
||||
public void setSource(PollableSource<?> source) {
|
||||
public void setSource(MessageSource<?> source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ package org.springframework.integration.message;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public interface BlockingSource<T> extends PollableSource<T> {
|
||||
public interface BlockingSource<T> extends MessageSource<T> {
|
||||
|
||||
/**
|
||||
* Receive a message, blocking indefinitely if necessary.
|
||||
|
||||
@@ -17,10 +17,16 @@
|
||||
package org.springframework.integration.message;
|
||||
|
||||
/**
|
||||
* Base interface for any source of {@link Message Messages}.
|
||||
* Base interface for any source of {@link Message Messages} that can be polled.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public interface MessageSource<T> {
|
||||
|
||||
/**
|
||||
* Retrieve the next available message from this source.
|
||||
* Returns <code>null</code> if no message is available.
|
||||
*/
|
||||
Message<T> receive();
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class MethodInvokingSource implements PollableSource<Object>, InitializingBean {
|
||||
public class MethodInvokingSource implements MessageSource<Object>, InitializingBean {
|
||||
|
||||
private volatile Object object;
|
||||
|
||||
|
||||
@@ -1,31 +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;
|
||||
|
||||
/**
|
||||
* Base interface for any source of {@link Message Messages} that can be polled.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public interface PollableSource<T> extends MessageSource<T> {
|
||||
|
||||
/**
|
||||
* Retrieve a message from this source or <code>null</code> if no message is available.
|
||||
*/
|
||||
Message<T> receive();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user