Coverage Report - org.apache.camel.example.bam.MyActivities
 
Classes in this File Line Coverage Branch Coverage Complexity
MyActivities
0% 
N/A 
0
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.camel.example.bam;
 18  
 
 19  
 import org.apache.camel.Exchange;
 20  
 import org.apache.camel.Processor;
 21  
 import org.apache.camel.bam.ActivityBuilder;
 22  
 import org.apache.camel.bam.ProcessBuilder;
 23  
 import org.apache.commons.logging.Log;
 24  
 import org.apache.commons.logging.LogFactory;
 25  
 
 26  
 import org.springframework.orm.jpa.JpaTemplate;
 27  
 import org.springframework.transaction.support.TransactionTemplate;
 28  
 
 29  
 import static org.apache.camel.builder.xml.XPathBuilder.xpath;
 30  
 import static org.apache.camel.util.Time.seconds;
 31  
 
 32  
 /**
 33  
  * @version $Revision: $
 34  
  */
 35  
 // START SNIPPET: example
 36  0
 public class MyActivities extends ProcessBuilder {
 37  0
     private static final Log LOG = LogFactory.getLog(MyActivities.class);
 38  
 
 39  
     protected MyActivities(JpaTemplate jpaTemplate, TransactionTemplate transactionTemplate) {
 40  0
         super(jpaTemplate, transactionTemplate);
 41  0
     }
 42  
 
 43  
     public void configure() throws Exception {
 44  
 
 45  
         // lets define some activities, correlating on an XPath on the message bodies
 46  0
         ActivityBuilder purchaseOrder = activity("file:src/data/purchaseOrders?noop=true")
 47  
                 .correlate(xpath("/purchaseOrder/@id"));
 48  
 
 49  0
         ActivityBuilder invoice = activity("file:src/data/invoices?noop=true")
 50  
                 .correlate(xpath("/invoice/@purchaseOrderId"));
 51  
 
 52  
         // now lets add some rules
 53  0
         invoice.starts().after(purchaseOrder.completes())
 54  
                 .expectWithin(seconds(1))
 55  
                 .errorIfOver(seconds(2)).to("log:org.apache.camel.example.bam.BamFailures?level=error");
 56  
 
 57  0
         from("seda:failures").process(new Processor() {
 58  0
             public void process(Exchange exchange) throws Exception {
 59  0
                 LOG.info("Failed process!: " + exchange + " with body: " + exchange.getIn().getBody());
 60  0
             }
 61  
         });
 62  0
     }
 63  
 };
 64  
 // END SNIPPET: example