You can do it using the actuator (see Binding Visualization and Control). Or you can invoke the endpoint programmatically.
@SpringBootApplication
@EnableBinding(Sink.class)
public class So58795176Application {
public static void main(String[] args) {
SpringApplication.run(So58795176Application.class, args);
}
@StreamListener(Sink.INPUT)
public void listen(String in) {
System.out.println();
}
@Autowired
BindingsEndpoint endpoint;
@Bean
public ApplicationRunner runner() {
return args -> {
System.in.read();
endpoint.changeState("input", State.STOPPED);
System.in.read();
endpoint.changeState("input", State.STARTED);
};
}
}