Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. @SpringBootApplication
  2. public class So40962780Application {
  3.  
  4. public static void main(String[] args) {
  5. SpringApplication.run(So40962780Application.class, args);
  6. }
  7.  
  8. @InboundChannelAdapter(channel = "in", poller = @Poller(fixedRate = "5000"))
  9. public String gen() {
  10. return "foo";
  11. }
  12.  
  13. @ServiceActivator(inputChannel = "in", outputChannel = "out")
  14. public ListenableFuture<String> foo(String in) {
  15. SettableListenableFuture<String> future = new SettableListenableFuture<>();
  16. future.set(in.toUpperCase());
  17. return future;
  18. }
  19.  
  20. @ServiceActivator(inputChannel = "out")
  21. public void syso(Object payload) {
  22. System.out.println(payload);
  23. }
  24.  
  25. @Bean
  26. public AsyncConfigurer asyncConfigurer() {
  27. return new AsyncConfigurer();
  28. }
  29.  
  30. public static class AsyncConfigurer {
  31.  
  32. @Autowired
  33. @Qualifier("so40962780Application.foo.serviceActivator.handler")
  34. private AbstractReplyProducingMessageHandler fooHandler;
  35.  
  36. @PostConstruct
  37. public void configureAsync() {
  38. this.fooHandler.setAsync(true);
  39. }
  40.  
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement