1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.core.support.transformer;
17
18 import org.apache.camel.Exchange;
19 import org.apache.camel.Processor;
20
21
22
23
24 public class FailureTransformer implements Processor {
25
26 private boolean error;
27
28 public FailureTransformer() {
29 this(false);
30 }
31
32 public FailureTransformer(boolean error) {
33 this.error = error;
34 }
35
36 public void process(Exchange exchange) throws Exception {
37 if (error) {
38 throw new RuntimeException("failed");
39 } else {
40 exchange.getOut().setBody("failed");
41 exchange.getOut().setFault(true);
42 }
43 }
44
45 }