Added 'name' property to channel, and PointToPointChannel now implements BeanNameAware.

This commit is contained in:
Mark Fisher
2007-12-16 18:23:03 +00:00
parent bd81e7e441
commit d520ce9f85
2 changed files with 19 additions and 1 deletions

View File

@@ -25,6 +25,10 @@ import org.springframework.integration.message.Message;
*/
public interface MessageChannel {
void setName(String name);
String getName();
/**
* Send a message, blocking indefinitely if necessary.
*

View File

@@ -20,6 +20,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageSelector;
@@ -30,11 +31,13 @@ import org.springframework.integration.message.MessageSelector;
*
* @author Mark Fisher
*/
public class PointToPointChannel implements MessageChannel {
public class PointToPointChannel implements MessageChannel, BeanNameAware {
private static final int DEFAULT_CAPACITY = 25;
private String name;
private BlockingQueue<Message> queue;
@@ -53,6 +56,17 @@ public class PointToPointChannel implements MessageChannel {
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public void setBeanName(String beanName) {
this.setName(beanName);
}
/**
* Send a message on this channel. If the queue is full, this method will
* block until either space becomes available or the sending thread is