Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Route:
- public void configure() throws Exception {
- from("quartz://batch?trigger.repeatCount=0&trigger.repeatInterval=0").beanRef("fileAggregator","collectFiles");
- }
- Receive: never breaks out
- public void collectFiles() {
- while (true) {
- Exchange exch = consumer.receive("file:///temp/src/data");
- if (exch==null) {
- break;
- }
- System.out.println(exch.getIn().getHeader(Exchange.FILE_NAME));
- }
- }
- ReceiveNoWait: breaks out immediately
- public void collectFiles() {
- while (true) {
- Exchange exch = consumer.receiveNoWait("file:///temp/src/data");
- if (exch==null) {
- break;
- }
- System.out.println(exch.getIn().getHeader(Exchange.FILE_NAME));
- }
- }
- Receive Wait 1000: breaks out immediately
- public void collectFiles() {
- while (true) {
- Exchange exch = consumer.receive("file:///temp/src/data",1000);
- if (exch==null) {
- break;
- }
- System.out.println(exch.getIn().getHeader(Exchange.FILE_NAME));
- }
- }
- Receive Wait 2000: System.out prints
- public void collectFiles() {
- while (true) {
- Exchange exch = consumer.receive("file:///temp/src/data",1000);
- if (exch==null) {
- break;
- }
- System.out.println(exch.getIn().getHeader(Exchange.FILE_NAME));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement