anchor.diff:  | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
   | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
   |=======================================================================
  +{% endraw %}
   // endpoint options: END
   
   
  -[[Firebase-MessageHeadersCamel]]
  +[[Ehcache-MessageHeadersCamel]]
   Message Headers Camel 
   ++++++++++++++++++++++
   
  -
  -[width="100%",cols="20%,10%,70%",options="header"]
  -|=======================================================================
  -| Header | Type | Description
  -| firebaseKey | `String` | The Firebase key to which a child listener is attached. This name of this parameter can be overriden using the *firebaseKey* option
  -|=======================================================================
  -
  -[[Firebase-Usageexamples]]
  -
  -Usage examples
  -^^^^^^^^^^^^^^
  -
  -[[Firebase-Consumer]]
  -Firebase Consumer
  -+++++++++++++++++
  -
  -The code below demonstrates how you can create a route which consumes the messages coming from a Firebase listener.
  + 
  +[width="100%",cols="10%,10%,80%",options="header",]
  +|=======================================================================
  +|Header |Type |Description
  +
  +|CamelEhcacheAction |`String` |The operation to be perfomed on the cache, valid options are:
  +
  +* CLEAR
  +* PUT
  +* PUT_ALL
  +* PUT_IF_ABSENT
  +* GET
  +* GET_ALL
  +* REMOVE
  +* REMOVE_ALL
  +* REPLACE
  +
  +|CamelEhcacheActionHasResult |Boolean |Set to true if the action has a result
  +
  +|CamelEhcacheActionSucceeded |`Boolean` |Set to true if the actionsuccedded
  +
  +|CamelEhcacheKey |Object |The cache key used for an action
  +
  +|CamelEhcacheKeys |Set<Object> |A list of keys, used in
  +
  +* PUT_ALL
  +* GET_ALL
  +* REMOVE_ALL
  +
  +|CamelEhcacheValue |Object |The value to put in the cache or the result of an operation
  +
  +|CamelEhcacheOldValue |Object |The old value associated to a key for actions like PUT_IF_ABSENT or the
  +Object used for comparison for actions like REPLACE
  +
  +|CamelEhcacheEventType |EventType |The type of event received
  +|=======================================================================
  +
  +[[Ehcache-Ehcachebasedidempotentrepositoryexample:]]
  +Ehcache based idempotent repository example:
  +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
   [source,java]
  ---------------------------------------------------------------------------------------
  -@Override
  -protected RouteBuilder createRouteBuilder() throws Exception {
  -    final String databaseUrl = "gil-sample-app.firebaseio.com";
  -    final String originalRootReference = "server/saving-data";
  -    String serviceAccountFile = ConfigurationProvider.createFirebaseConfigLink();
  -    String rootReference = URLEncoder.encode(originalRootReference, "UTF-8");
  -    insertDummyData(String.format("https://%s", databaseUrl), originalRootReference, serviceAccountFile);
  -
  -    return new RouteBuilder() {
  -        public void configure() {
  -            try {
  -                from(String.format("firebase://" + databaseUrl + "?rootReference=%s&serviceAccountFile=%s",
  -                        rootReference, serviceAccountFile))
  -                        .to("log:firebasetest?level=WARN")
  -                        .to("mock:result");
  -            } catch (Exception e) {
  -                fail(e.toString());
  +------------------------------------------------------------------------------------------------
  +CacheManager manager = CacheManagerBuilder.newCacheManager(new XmlConfiguration("ehcache.xml"));
  +EhcacheIdempotentRepository repo = new EhcacheIdempotentRepository(manager, "idempotent-cache");
  + 
  +from("direct:in")
  +    .idempotentConsumer(header("messageId"), idempotentRepo)
  +    .to("mock:out");
  +------------------------------------------------------------------------------------------------
  +
  + 
  +
  +[[Ehcache-Ehcachebasedaggregationrepositoryexample:]]
  +Ehcache based aggregation repository example:
  +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  +
  +[source,java]
  +---------------------------------------------------------------------------------------------------------------------------------
  +public class EhcacheAggregationRepositoryRoutesTest extends CamelTestSupport {
  +    private static final String ENDPOINT_MOCK = "mock:result";
  +    private static final String ENDPOINT_DIRECT = "direct:one";
  +    private static final int[] VALUES = generateRandomArrayOfInt(10, 0, 30);
  +    private static final int SUM = IntStream.of(VALUES).reduce(0, (a, b) -> a + b);
  +    private static final String CORRELATOR = "CORRELATOR";
  +
  +    @EndpointInject(uri = ENDPOINT_MOCK)
  +    private MockEndpoint mock;
  +
  +    @Produce(uri = ENDPOINT_DIRECT)
  +    private ProducerTemplate producer;
  +
  +    @Test
  +    public void checkAggregationFromOneRoute() throws Exception {
  +        mock.expectedMessageCount(VALUES.length);
  +        mock.expectedBodiesReceived(SUM);
  +
  +        IntStream.of(VALUES).forEach(
  +            i -> producer.sendBodyAndHeader(i, CORRELATOR, CORRELATOR)
  +        );
  +
  +        mock.assertIsSatisfied();
  +    }
  +
  +    private Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
  +        if (oldExchange == null) {
  +            return newExchange;
  +        } else {
  +            Integer n = newExchange.getIn().getBody(Integer.class);
  +            Integer o = oldExchange.getIn().getBody(Integer.class);
  +            Integer v = (o == null ? 0 : o) + (n == null ? 0 : n);
  +
  +            oldExchange.getIn().setBody(v, Integer.class);
  +
  +            return oldExchange;
  +        }
  +    }
  +
  +    @Override
  +    protected RoutesBuilder createRouteBuilder() throws Exception {
  +        return new RouteBuilder() {
  +            @Override
  +            public void configure() throws Exception {
  +                from(ENDPOINT_DIRECT)
  +                    .routeId("AggregatingRouteOne")
  +                    .aggregate(header(CORRELATOR))
  +                    .aggregationRepository(createAggregateRepository())
  +                    .aggregationStrategy(EhcacheAggregationRepositoryRoutesTest.this::aggregate)
  +                    .completionSize(VALUES.length)
  +                        .to("log:org.apache.camel.component.ehcache.processor.aggregate.level=INFO&showAll=true&mulltiline=true")
  +                        .to(ENDPOINT_MOCK);
               }
  -        }
  -    };
  +        };
  +    }
  +
  +    protected EhcacheAggregationRepository createAggregateRepository() throws Exception {
  +        CacheManager cacheManager = CacheManagerBuilder.newCacheManager(new XmlConfiguration("ehcache.xml"));
  +        cacheManager.init();
  +
  +        EhcacheAggregationRepository repository = new EhcacheAggregationRepository();
  +        repository.setCacheManager(cacheManager);
  +        repository.setCacheName("aggregate");
  +
  +        return repository;
  +    }
   }
  ---------------------------------------------------------------------------------------
  -
  -[[Firebase-Producer]]
  -Firebase Producer
  -+++++++++++++++++
  -
  -The example below shows how you can send data to Firebase.
  -
  -[source,java]
  ---------------------------------------
  -CamelContext context = new DefaultCamelContext();
  -context.addRoutes(new RouteBuilder() {
  -    @Override
  -    public void configure() throws Exception {
  -        String rootReference = URLEncoder.encode("server/saving-data", "UTF-8");
  -        String serviceAccountFile = "firebase-admin-connection.json";
  -        from(sampleInputProvider.getTargetFolder().toUri().toString())
  -            .process(exchange -> {
  -                GenericFile file = (GenericFile) exchange.getIn().getBody();
  -                String content = new String(Files.readAllBytes(Paths.get(file.getAbsoluteFilePath())), "UTF-8");
  -                String[] keyValue = content.split("=");
  -                final Message out = exchange.getOut();
  -                out.setHeader("firebaseKey", keyValue[0]);
  -                out.setBody(keyValue[1].trim());
  -            })
  -            .to(String.format("firebase://%s?rootReference=%s&serviceAccountFile=%s&reply=%b",
  -                    "gil-sample-app.firebaseio.com", rootReference, serviceAccountFile, reply))
  -            .to("log:whenFirebaseSet?level=WARN")
  -            .process(exchange1 -> {
  -                assertThat(exchange1.getIn().getBody().getClass()).isEqualTo(expectedBodyClass);
  -                if (reply) {
  -                    assertThat(exchange1.getIn().getHeader("firebaseKey")).isNotNull();
  -                }
  -                try {
  -                    reentrantLock.lock();
  -                    wake.signal();
  -                } finally {
  -                    reentrantLock.unlock();
  -                }
  -            });
  -    }
  -});
  ---------------------------------------
  -
  -[[Exec-SeeAlso]]
  -See Also
  -^^^^^^^^
  -
  -* link:configuring-camel.html[Configuring Camel]
  -* link:component.html[Component]
  -* link:endpoint.html[Endpoint]
  -* link:getting-started.html[Getting Started]
  -* link:https://firebase.google.com/[Firebase]
  -* link:https://console.firebase.google.com/[Firebase console]+---------------------------------------------------------------------------------------------------------------------------------
  
positive.code: </dependency>
  ------------------------------------------------------------
  
  [[Firebase-URIformat]]
  URI format
  ^^^^^^^^^^
  
  [source,java]
  -----------------------------
  firebase://[endpoint]?[options]
  -----------------------------
  
  You can append query options to the URI in the following
  format, `?option=value&option=value1&...`
  
  Do not forget to URL encode the option values.
  
  [[Firebase-Options]]
  Options
  ^^^^^^^
  
  // endpoint options: START
  The Firebase component supports 9 endpoint options which are listed below:
  
  [width="100%",cols="2,1,1m,1m,5",options="header"]
  |=======================================================================
  | Name | Group | Default | Java Type | Description
  | keyName | common | firebaseKey | String | The Camel exchange header name in which the Firebase key is specified. Only needed in case you are saving or updating data
  | reply | common | false | boolean | If *false* the save or update request (*setValue* in Firebase terms) is fired and the reply will be ignored, otherwise the routing thread will wait and the reply will be saved in the body of the exchange message
  | rootReference | common |  | String | *Required* The path in the database tree where the key value pairs are to be stored
  | serviceAccountFile | common |  | String | *Required* The path to the JSON file which provided the keys used to connect to Firebase. This file is typically generated when you create the database
  | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
  
negative.code: Firebase Component
  ~~~~~~~~~~~~~~~~~
  
  *Available as of Camel 2.18.x*
  
  The *firebase* component enables you to save, modify data in Google Firebase database
  and consume to all child of a specific reference.
  