Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Karaf Cellar

You're reading from   Learning Karaf Cellar Build and implement a complete clustering solution for the Apache Karaf OSGi container

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781783984602
Length 124 pages
Edition 1st Edition
Arrow right icon
Authors (2):
Arrow left icon
Jean Baptiste Onofre Jean Baptiste Onofre
Author Profile Icon Jean Baptiste Onofre
Jean Baptiste Onofre
Jean-Baptiste Onofré Jean-Baptiste Onofré
Author Profile Icon Jean-Baptiste Onofré
Jean-Baptiste Onofré
Arrow right icon
View More author details
Toc

Caching with a distributed map


Another use case for Cellar and camel-hazelcast together is the implementation of a distributed cache solution.

The camel-hazelcast component allows you to use a distributed map and execute different operations on this map.

As it's distributed, it means that the data is spread between different nodes: all nodes can see the same data (entries/values) from the distributed map. This means that you can share data between nodes.

In a Camel route, you can perform the following operations on the distributed map:

  • put: To add new data in the map

  • delete: To remove data from the map

  • get: To retrieve all data from the map

  • query: To retrieve particular data from the map

The operation type is defined in the CamelHazelcastOperationType header.

For instance, we can implement a route that updates the cache with the following code:

<route>
  <from uri="direct-vm:add-in-cache"/>
  <setHeader headerName="CamelHazelcastOperationType">
    <constant>put</constant...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime