Removed the PollableSource interface, and migrated the 'receive()' method to MessageSource.

This commit is contained in:
Mark Fisher
2008-09-26 16:31:26 +00:00
parent 78c49157bd
commit 9ee921ed7c
18 changed files with 35 additions and 141 deletions

View File

@@ -39,7 +39,7 @@ import org.springframework.integration.message.ErrorMessage;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.PollableSource;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.scheduling.IntervalTrigger;
@@ -269,7 +269,7 @@ public class DefaultMessageBusTests {
}
private static class FailingSource implements PollableSource<Object> {
private static class FailingSource implements MessageSource<Object> {
private CountDownLatch latch;

View File

@@ -1,32 +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.channel.config;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.PollableSource;
import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
*/
public class TestPollableSource implements PollableSource<String> {
public Message<String> receive() {
return new StringMessage("test");
}
}

View File

@@ -17,13 +17,13 @@
package org.springframework.integration.channel.config;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.PollableSource;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
*/
public class TestSource implements PollableSource<String> {
public class TestSource implements MessageSource<String> {
private final String text;

View File

@@ -1,48 +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.channel.config;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageConsumer;
import org.springframework.integration.message.Subscribable;
/**
* @author Mark Fisher
*/
public class TestSubscribableSource implements Subscribable {
private final List<MessageConsumer> subscibers = new CopyOnWriteArrayList<MessageConsumer>();
public boolean subscribe(MessageConsumer subsciber) {
return this.subscibers.add(subsciber);
}
public boolean unsubscribe(MessageConsumer subsciber) {
return this.subscibers.remove(subsciber);
}
public void publishMessage(Message<?> message) {
for (MessageConsumer subsciber : this.subscibers) {
subsciber.onMessage(message);
}
}
}

View File

@@ -17,14 +17,14 @@
package org.springframework.integration.config;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.PollableSource;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
*/
@SuppressWarnings("unchecked")
public class TestSource implements PollableSource {
public class TestSource implements MessageSource {
public Message<?> receive() {
return new StringMessage("test");