= Hazelcast Instance Component
:doctitle: Hazelcast Instance
:shortname: hazelcast-instance
:artifactid: camel-hazelcast
:description: Consume join/leave events of a cache instance in a Hazelcast cluster.
:since: 2.7
:supportlevel: Stable
:tabs-sync-option:
:component-header: Only consumer is supported
//Manually maintained attributes
:group: Hazelcast
:camel-spring-boot-name: hazelcast

*Since Camel {since}*

*{component-header}*

The http://www.hazelcast.com/[Hazelcast] instance component is one of Camel Hazelcast Components which allows you to consume join/leave events of the cache instance in the cluster.
Hazelcast makes sense in one single "server node", but it's extremely powerful in a clustered environment.

// component-configure options: START

// component-configure options: END

// component options: START
include::partial$component-configure-options.adoc[]
include::partial$component-endpoint-options.adoc[]
// component options: END

// endpoint options: START

// endpoint options: END


== instance consumer - from("hazelcast-instance:foo")

The instance consumer fires if a new cache instance joins or leaves the cluster.
 
Here's a sample:

[source,java]
-----------------------------------------------------------------------------------------
fromF("hazelcast-%sfoo", HazelcastConstants.INSTANCE_PREFIX)
.log("instance...")
.choice()
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
        .log("...added")
        .to("mock:added")
    .otherwise()
        .log("...removed")
        .to("mock:removed");
-----------------------------------------------------------------------------------------

// component headers: START
include::partial$component-endpoint-headers.adoc[]
// component headers: END

include::spring-boot:partial$starter.adoc[]
