Commit 9fc9523c authored by Gary Russell's avatar Gary Russell Committed by Dave Syer

CLI Integration Sample Shutdown

Fixes gh-761

Also add some sugar to the println so that it stands
out a little against the logging.
parent f95ee7ab
...@@ -4,6 +4,9 @@ package org.test ...@@ -4,6 +4,9 @@ package org.test
@EnableIntegration @EnableIntegration
class SpringIntegrationExample implements CommandLineRunner { class SpringIntegrationExample implements CommandLineRunner {
@Autowired
private ApplicationContext context;
@Bean @Bean
DirectChannel input() { DirectChannel input() {
new DirectChannel(); new DirectChannel();
...@@ -11,7 +14,17 @@ class SpringIntegrationExample implements CommandLineRunner { ...@@ -11,7 +14,17 @@ class SpringIntegrationExample implements CommandLineRunner {
@Override @Override
void run(String... args) { void run(String... args) {
println new MessagingTemplate(input()).convertSendAndReceive("World", String) println()
println '>>>> ' + new MessagingTemplate(input()).convertSendAndReceive("World", String) + ' <<<<'
println()
/*
* Since this is a simple application that we want to exit right away,
* close the context. For an active integration application, with pollers
* etc, you can either suspend the main thread here (e.g. with System.in.read()),
* or exit the run() method without closing he context, and stop the
* application later using some other technique (kill, JMX etc).
*/
context.close()
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment