From bb32ce39c8fc9e3fdcb6a61acd8391d8bc5892ef Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 28 May 2015 18:27:07 +0100 Subject: [PATCH] Document briefly support for multiple channels --- README.md | 4 ++++ .../bus/runner/config/MessageBusAdapterConfiguration.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82b5e957e..07f8521e8 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ spring: To be deployable as an XD module in a "traditional" way you need `/config/*.properties` to point to any available Java config classes (via `base_packages` or `options_class`), or else you can put traditional XML configuration in `/config/*.xml`. You don't need those things to run as a consumer or producer to an existing XD system. There's an XML version of the same sample (a "timer" source). +## Multiple Input or Output Channels + +A module can have multiple input or output channels. Instead of just one channel named "input" or "output" you can add multiple `MessageChannel` beans named `input.*` or `output.*` and the names are converted to external channel names on the bus. The external channel names are the "natural" channel name for the module (i.e. `.` or `spring.bus.[input|output]ChannelName` if supplied) plus the `MessageChannel` bean name, period separated. In addition, the bean name can be `input.[queue|topic|tap]:*` or `output.[queue|topic]:*` (i.e. with a channel type as a colon-separated prefix), and the semantics of the external bus channel changes accordingly (a tap is like a topic). For example, you can have two `MessageChannels` called "output" and "output.topic:foo" in a module deployed with "group=bar" and "index=2", and the result is 2 external channels called "bar.2" and "topic:foo.bar.2". + ## XD Module Samples There are several samples, all running on the redis transport (so you need redis running locally to test them): diff --git a/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java b/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java index be079d3c5..c097d029f 100644 --- a/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java +++ b/spring-bus-core/src/main/java/org/springframework/bus/runner/config/MessageBusAdapterConfiguration.java @@ -118,7 +118,7 @@ public class MessageBusAdapterConfiguration { String channelName = module.getInputChannelName(); channels.put( channelName, - new OutputChannelSpec(channelName, beanFactory.getBean(name, + new InputChannelSpec(channelName, beanFactory.getBean(name, MessageChannel.class))); } else if (name.startsWith("input.")) { @@ -138,7 +138,7 @@ public class MessageBusAdapterConfiguration { } channels.put( channelName, - new OutputChannelSpec(channelName, beanFactory.getBean(name, + new InputChannelSpec(channelName, beanFactory.getBean(name, MessageChannel.class))); } }