From d520ce9f85485b70bf99a203f56aec4e840a8ed4 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Sun, 16 Dec 2007 18:23:03 +0000 Subject: [PATCH] Added 'name' property to channel, and PointToPointChannel now implements BeanNameAware. --- .../integration/channel/MessageChannel.java | 4 ++++ .../integration/channel/PointToPointChannel.java | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannel.java index e415c0683c..69bb51bf7f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannel.java @@ -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. * diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PointToPointChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PointToPointChannel.java index 3f233fc47b..62ab1c1139 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PointToPointChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PointToPointChannel.java @@ -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 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