org.apache.camel.Handler Java Examples
The following examples show how to use
org.apache.camel.Handler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandProcessor.java From secure-data-service with Apache License 2.0 | 6 votes |
@Handler public void processCommand(Exchange exch) throws Exception { String command = exch.getIn().getBody().toString(); LOG.info("Received: " + command); String[] chunks = command.split("\\|"); if (JOB_COMPLETED.equals(chunks[0])) { LOG.info("Clearing cache at job completion."); dumpAspectTrackers(chunks); } else { LOG.error("Unsupported command"); } }
Example #2
Source File: FileEntryLatch.java From secure-data-service with Apache License 2.0 | 6 votes |
@Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId(), workNote.getFileEntry().getFileName())) { RangedWorkNote wn = RangedWorkNote.createSimpleWorkNote(batchJobId); exchange.getIn().setBody(wn, RangedWorkNote.class); return true; } return false; }
Example #3
Source File: MyHelper.java From iot-ocp with Apache License 2.0 | 6 votes |
@Handler public String enhanceMessage( String body, Exchange exchange ) { String[] topicParts = exchange.getIn().getHeader("CamelMQTTSubscribeTopic", String.class).split(TOPIC_SEPARTOR); if(topicParts.length != 4) { throw new IllegalArgumentException("Invalid number of topic components. Expected " + TOPIC_PART_SIZE + ". Was " + topicParts.length); } StringBuilder sb = new StringBuilder(); sb.append(body); sb.append(COMMA); sb.append(topicParts[1]); sb.append(COMMA); sb.append(topicParts[2]); sb.append(COMMA); sb.append(topicParts[3]); return sb.toString(); }
Example #4
Source File: ActivityTracingWithSplitTest.java From syndesis with Apache License 2.0 | 5 votes |
@Handler public String process(String body) { if ("error".equals(body)) { throw new RuntimeException("Bean Error"); } return body + " World"; }
Example #5
Source File: ActivitiRouteBuilder.java From servicemix with Apache License 2.0 | 5 votes |
@Handler public Map getProcessVariables(@Body String body, @Header(Exchange.FILE_NAME) String filename, @Simple("${date:now:yyyy-MM-dd kk:mm:ss}") String timestamp) { Map<String, Object> variables = new HashMap<String, Object>(); variables.put("message", body); variables.put("orderid", filename); variables.put("timestamp", timestamp); return variables; }
Example #6
Source File: BookOrderExample.java From camelinaction2 with Apache License 2.0 | 5 votes |
@Handler public void orderSomeBooks() throws Exception { log.info("-------------------------------------------------------------------------------------------------------------------------"); log.info("Make sure to have Postgres database up and running, as configured in the src/test/resources/META-INF/persistence.xml file"); log.info("-------------------------------------------------------------------------------------------------------------------------"); BookOrder order = new BookOrder(); order.setAmount(1); order.setTitle("Camel in Action 2nd ed"); template.sendBody("jpa:camelinaction.BookOrder", order); Thread.sleep(5000); log.info("... sleeping for 5 seconds and then stopping the route"); // now stop the route context.stopRoute("books"); // insert a new order which will sit in the database BookOrder order2 = new BookOrder(); order2.setAmount(3); order2.setTitle("ActiveMQ in Action"); template.sendBody("jpa:camelinaction.BookOrder", order2); log.info("-------------------------------------------------------------------------------------------------------------------------"); log.info("Now we want to provoke a connection error, so stop the postgres database - and then press ENTER to continue!"); log.info("-------------------------------------------------------------------------------------------------------------------------"); System.console().readLine(); context.startRoute("books"); log.info("... starting route which should indicate some errors, which the bridge error handler should catch and handle"); log.info("Notice that the consumer will backoff and not poll so fast, instead of every second, it now runs x10 sec."); log.info("Press CTRL+C to exit this application!"); }
Example #7
Source File: ThrowBpmnExceptionBean.java From flowable-engine with Apache License 2.0 | 5 votes |
@Handler public void throwNonBpmnException() throws Exception { LOGGER.debug("throwing non bpmn bug"); switch (getExceptionType()) { case NO_EXCEPTION: break; case NON_BPMN_EXCEPTION: throw new Exception("arbitrary non bpmn exception"); case BPMN_EXCEPTION: throw new BpmnError("testError"); } }
Example #8
Source File: ThrowBpmnExceptionBean.java From flowable-engine with Apache License 2.0 | 5 votes |
@Handler public void throwNonBpmnException() throws Exception { LOGGER.debug("throwing non bpmn bug"); switch (getExceptionType()) { case NO_EXCEPTION: break; case NON_BPMN_EXCEPTION: throw new Exception("arbitrary non bpmn exception"); case BPMN_EXCEPTION: throw new BpmnError("testError"); } }
Example #9
Source File: RngErrorAction.java From syndesis-extensions with Apache License 2.0 | 5 votes |
@Handler public void handle(@Body String body, @Headers Map headers, Exchange exchange) { Random random = new Random(System.currentTimeMillis()); if( random.nextBoolean() ) { throw new RuntimeCamelException("Random error.. try your luck again next time."); } }
Example #10
Source File: __extension-name__Extension.java From syndesis with Apache License 2.0 | 5 votes |
@Handler public void log(@Body Object body){ if(trace) { LOGGER.trace("Body is: {}",body); } else { LOGGER.info("Body is: {}",body); } }
Example #11
Source File: ActionStep.java From syndesis with Apache License 2.0 | 5 votes |
@Handler public List<Out> process(@Body In body) { List<Out> out = new ArrayList<>(); out.add(new Out()); return out; }
Example #12
Source File: ActionStep.java From syndesis with Apache License 2.0 | 5 votes |
@Handler public List<Out> process(@Body In body) { List<Out> out = new ArrayList<>(); out.add(new Out()); return out; }
Example #13
Source File: ThrowBpmnExceptionBean.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Handler public void throwNonBpmnException() throws Exception { LOG.debug("throwing non bpmn bug"); switch (getExceptionType()) { case NO_EXCEPTION: break; case NON_BPMN_EXCEPTION: throw new Exception("arbitary non bpmn exception"); case BPMN_EXCEPTION: throw new BpmnError("testError"); } }
Example #14
Source File: ThrowBpmnExceptionBean.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Handler public void throwNonBpmnException() throws Exception { LOG.debug("throwing non bpmn bug"); switch (getExceptionType()) { case NO_EXCEPTION: break; case NON_BPMN_EXCEPTION: throw new Exception("arbitary non bpmn exception"); case BPMN_EXCEPTION: throw new BpmnError("testError"); } }
Example #15
Source File: ExtensionStepHandlerTest.java From syndesis with Apache License 2.0 | 4 votes |
@Handler public void handle(@Body String body) { // NO-OP }
Example #16
Source File: OutMessageCaptureProcessorTest.java From syndesis with Apache License 2.0 | 4 votes |
@Handler public String[] apply(@Body String body) { return new String[]{ "Hiram", "World" }; }
Example #17
Source File: AnnotatorJavaBeanTestData.java From camel-idea-plugin with Apache License 2.0 | 4 votes |
@Handler public void myOverLoadedBean3(String name) {}
Example #18
Source File: OutMessageCaptureProcessorTest.java From syndesis with Apache License 2.0 | 4 votes |
@Handler public int apply(@Body String body) { return body.hashCode(); }
Example #19
Source File: OutMessageCaptureProcessorTest.java From syndesis with Apache License 2.0 | 4 votes |
@Handler public String apply(@Body String body) { return "Hello " + body; }
Example #20
Source File: CountDownLatchDecrementer.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Handler public void decrement(Exchange exchange) { LOG.info("Decrementing latch count: " + label); latch.countDown(); }