Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. from("quartz://timerName?trigger.repeatCount=0&trigger.repeatInterval=0")
  2. .setHeader(Constants.BATCH_CORRELATION_ID, new SimpleExpression("CORRELATION"))
  3. .setHeader(Constants.LAST_FILE, new ConstantExpression("TRUE"))
  4. .to("direct:aggregate");
  5.  
  6. from("file:///temp/src/data/process?delete=false&move=success&moveFailed=error")
  7. .setHeader(Constants.BATCH_CORRELATION_ID, new SimpleExpression("CORRELATION"))
  8. .convertBodyTo(InputStream.class)
  9. .to("direct:aggregate");
  10.  
  11. from("direct:aggregate")
  12. .aggregate(header(Constants.BATCH_CORRELATION_ID), new GroupedExchangeAggregationStrategy())
  13. .eagerCheckCompletion()
  14. .completionPredicate(header(Constants.LAST_FILE).isEqualTo("TRUE"))
  15. .processRef("fileProcessor");
  16.  
  17. onException(ProcessingException.class).processRef("myError")
  18. .to("file:///temp/src/data/process/error");
  19.  
  20.  
  21.  
  22. public void process(Exchange exch) throws Exception {
  23. Message m = exch.getIn();
  24. List<Exchange> ge = exch.getProperty(Exchange.GROUPED_EXCHANGE, List.class);
  25. for (Exchange e : ge) {
  26. String HostfileType = (String) e.getIn().getHeader(Constants.HOST_FILETYPE);
  27. InputStream fis = e.getIn().getBody(InputStream.class);
  28. if (e.getIn().getBody()!=null) {
  29. // do something here
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement