diff --git a/basic/jmx/.settings/com.springsource.sts.config.flow.prefs b/basic/jmx/.settings/com.springsource.sts.config.flow.prefs
new file mode 100644
index 00000000..f7a70b6e
--- /dev/null
+++ b/basic/jmx/.settings/com.springsource.sts.config.flow.prefs
@@ -0,0 +1,3 @@
+#Thu Jan 13 15:32:55 EST 2011
+//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/jmx/src/main/resources/META-INF/spring/integration/ControlBusDemo-context.xml=\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
+eclipse.preferences.version=1
diff --git a/basic/jmx/.springBeans b/basic/jmx/.springBeans
index 15608f30..46d8806e 100644
--- a/basic/jmx/.springBeans
+++ b/basic/jmx/.springBeans
@@ -1,12 +1,13 @@
1
-
+
+ src/main/resources/META-INF/spring/integration/ControlBusDemo-context.xml
diff --git a/basic/jmx/readme.txt b/basic/jmx/readme.txt
index c6ede142..cc14a0b6 100644
--- a/basic/jmx/readme.txt
+++ b/basic/jmx/readme.txt
@@ -1,6 +1,7 @@
This example demonstrates the following aspects of the JMX support available with Spring Integration:
1. JMX Attribute Polling Channel
2. JMX Operation Invoking Channel Adapter
+3. Control Bus
StopWatch is a Managed Bean. It is bootstraped and deployed using annotation support (@Component, @ManagedResource)
and component scanning functionality provided by Spring JMX. Internally StopWatch simply runs a task that increments the
@@ -13,8 +14,10 @@ The interesting this is that 'seconds' channel is a publish-subscribe-channel an
Once the payload value is 10 filter sends the Message to a 'reset' channel which is represented as JMX Operation Invoking Channel Adapter
which simply invokes 'reset' operation on the same StopWatch MBean resetting 'Seconds' attribute value back to 1 and the process repeats.
+Another example is a Control Bus which uses SpEL to send a Control Message to start/stop and inbound adapter
-To run samples simply execute the 3 test cases located in the org.springframework.integration.samples.filecopy package
+
+To run JMX Adapter sample simple execute JmxAdapterDemoTest
You will see the output similar to this which will loop for ~ 20 sec:
1
@@ -32,3 +35,11 @@ You will see the output similar to this which will loop for ~ 20 sec:
3
. . .
+To run Control Bus sample simple execute ControlBusDemoTest
+
+You will see the output similar to this
+
+INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received before adapter started: null
+INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received before adapter started: [Payload=Hello][Headers={timestamp=1294950897714, id=240e72fb-93b0-4d38-8fe8-b701cf7e9a5d}]
+INFO : org.springframework.integration.samples.jmx.ControlBusDemo - Received after adapter stopped: null
+
diff --git a/basic/jmx/src/main/resources/META-INF/spring/integration/ControlBusDemo-context.xml b/basic/jmx/src/main/resources/META-INF/spring/integration/ControlBusDemo-context.xml
new file mode 100644
index 00000000..335d9989
--- /dev/null
+++ b/basic/jmx/src/main/resources/META-INF/spring/integration/ControlBusDemo-context.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/basic/jmx/src/test/java/org/springframework/integration/samples/jmx/ControlBusDemoTest.java b/basic/jmx/src/test/java/org/springframework/integration/samples/jmx/ControlBusDemoTest.java
new file mode 100644
index 00000000..1b58bc65
--- /dev/null
+++ b/basic/jmx/src/test/java/org/springframework/integration/samples/jmx/ControlBusDemoTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2002-2011 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.samples.jmx;
+
+import org.apache.log4j.Logger;
+import org.junit.Test;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.MessageChannel;
+import org.springframework.integration.core.PollableChannel;
+import org.springframework.integration.message.GenericMessage;
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class ControlBusDemoTest {
+
+ private static Logger logger = Logger.getLogger(ControlBusDemoTest.class);
+
+ @Test
+ public void demoControlBus(){
+ ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/ControlBusDemo-context.xml");
+ MessageChannel controlChannel = ac.getBean("controlChannel", MessageChannel.class);
+ PollableChannel adapterOutputChanel = ac.getBean("adapterOutputChanel", PollableChannel.class);
+ logger.info("Received before adapter started: " + adapterOutputChanel.receive(1000));
+ controlChannel.send(new GenericMessage("@inboundAdapter.start()"));
+ logger.info("Received before adapter started: " + adapterOutputChanel.receive(1000));
+ controlChannel.send(new GenericMessage("@inboundAdapter.stop()"));
+ logger.info("Received after adapter stopped: " + adapterOutputChanel.receive(1000));
+ }
+}