Guest User

Untitled

a guest
Jan 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. from(URI)
  2. .errorHandler(deadLetterChannel(format("log:%s?level=ERROR", MyClass.class.getName())))
  3. .onException(Throwable.class)
  4. .maximumRedeliveries(5).redeliveryDelay("1000")
  5. .to("log:error?showCaughtException=true")
  6. .end()
  7. .to("direct:first")
  8. .hystrix()
  9. .hystrixConfiguration()
  10. .end()
  11. .to("direct:second")
  12. .endHystrix()
  13. .to("direct:third")
  14. .to("log:success?level=INFO");
  15.  
  16. // ENDPOINTS
  17. @Consume(uri="direct:first")
  18. public String first(String payload) {
  19. return payload + " first";
  20. }
  21.  
  22. @Consume(uri="direct:second")
  23. public String second(String payload) {
  24. Random rand = new Random();
  25. if ((rand.nextInt() % 3) == 0) {
  26. throw new RuntimeException("msg");
  27. }
  28. return payload + " second";
  29. }
  30.  
  31. @Consume(uri="direct:third")
  32. public String third(String payload) {
  33. return payload + " third";
  34. }
Add Comment
Please, Sign In to add comment