ConfigurableApplicationContext 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<String>("@inboundAdapter.start()"));
logger.info("Received before adapter started: " + adapterOutputChanel.receive(1000));
controlChannel.send(new GenericMessage<String>("@inboundAdapter.stop()"));
logger.info("Received after adapter stopped: " + adapterOutputChanel.receive(1000));
ac.close();
}