Search in sources :

Example 1 with OutputStatusIncident

use of org.apache.camel.example.cxf.incident.OutputStatusIncident in project camel by apache.

the class CamelRoute method configure.

@Override
public void configure() throws Exception {
    from(uri).to("log:input").recipientList(simple("direct:${header.operationName}"));
    // report incident
    from("direct:reportIncident").process(new Processor() {

        public void process(Exchange exchange) throws Exception {
            // get the id of the input
            String id = exchange.getIn().getBody(InputReportIncident.class).getIncidentId();
            // set reply including the id
            OutputReportIncident output = new OutputReportIncident();
            output.setCode("OK;" + id);
            exchange.getOut().setBody(output);
        }
    }).to("log:output");
    // status incident
    from("direct:statusIncident").process(new Processor() {

        public void process(Exchange exchange) throws Exception {
            // set reply
            OutputStatusIncident output = new OutputStatusIncident();
            output.setStatus("IN PROGRESS");
            exchange.getOut().setBody(output);
        }
    }).to("log:output");
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) OutputReportIncident(org.apache.camel.example.cxf.incident.OutputReportIncident) OutputStatusIncident(org.apache.camel.example.cxf.incident.OutputStatusIncident) InputReportIncident(org.apache.camel.example.cxf.incident.InputReportIncident)

Example 2 with OutputStatusIncident

use of org.apache.camel.example.cxf.incident.OutputStatusIncident in project camel by apache.

the class CamelRouteClient method runTest.

protected void runTest() throws Exception {
    // create input parameter
    InputReportIncident input = new InputReportIncident();
    input.setIncidentId("123");
    input.setIncidentDate("2008-08-18");
    input.setGivenName("Claus");
    input.setFamilyName("Ibsen");
    input.setSummary("Bla");
    input.setDetails("Bla bla");
    input.setEmail("davsclaus@apache.org");
    input.setPhone("0045 2962 7576");
    // create the webservice client and send the request
    IncidentService client = createCXFClient();
    OutputReportIncident out = client.reportIncident(input);
    System.out.println(out.getCode());
    InputStatusIncident inStatus = new InputStatusIncident();
    inStatus.setIncidentId("456");
    OutputStatusIncident outStatus = client.statusIncident(inStatus);
    System.out.println(outStatus.getStatus());
}
Also used : IncidentService(org.apache.camel.example.cxf.incident.IncidentService) InputStatusIncident(org.apache.camel.example.cxf.incident.InputStatusIncident) OutputReportIncident(org.apache.camel.example.cxf.incident.OutputReportIncident) OutputStatusIncident(org.apache.camel.example.cxf.incident.OutputStatusIncident) InputReportIncident(org.apache.camel.example.cxf.incident.InputReportIncident)

Aggregations

InputReportIncident (org.apache.camel.example.cxf.incident.InputReportIncident)2 OutputReportIncident (org.apache.camel.example.cxf.incident.OutputReportIncident)2 OutputStatusIncident (org.apache.camel.example.cxf.incident.OutputStatusIncident)2 Exchange (org.apache.camel.Exchange)1 Processor (org.apache.camel.Processor)1 IncidentService (org.apache.camel.example.cxf.incident.IncidentService)1 InputStatusIncident (org.apache.camel.example.cxf.incident.InputStatusIncident)1