= Hazelcast Ringbuffer Component
:doctitle: Hazelcast Ringbuffer
:shortname: hazelcast-ringbuffer
:artifactid: camel-hazelcast
:description: Perform operations on Hazelcast distributed ringbuffer.
:since: 2.16
:supportlevel: Stable
:component-header: Only producer is supported
//Manually maintained attributes
:group: Hazelcast
:camel-spring-boot-name: hazelcast

*Since Camel {since}*

*{component-header}*

The http://www.hazelcast.com/[Hazelcast] ringbuffer component is one of Camel Hazelcast Components which allows you to access Hazelcast ringbuffer.
Ringbuffer is a distributed data structure where the data is stored in a ring-like structure. You can think of it as a circular array with a certain capacity. 


// 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


== ringbuffer cache producer 

The ringbuffer producer provides 5 operations:

* add
* readOnceHead
* readOnceTail
* remainingCapacity
* capacity

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

=== Sample for *put*:

Java DSL:

[source,java]
------------------------------------------------------------------------------------
from("direct:put")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.ADD))
.to(String.format("hazelcast-%sbar", HazelcastConstants.RINGBUFFER_PREFIX));
------------------------------------------------------------------------------------

Spring DSL:

[source,xml]
-----------------------------------------------------------------------------------------------
<route>
    <from uri="direct:put" />
    <log message="put.."/>
    <setHeader name="hazelcast.operation.type">
        <constant>add</constant>
    </setHeader>
    <to uri="hazelcast-ringbuffer:foo" />
</route>
-----------------------------------------------------------------------------------------------

=== Sample for *readonce from head*:

Java DSL:

[source,java]
-----------------------------------------------------------------------------------------------
from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastOperation.READ_ONCE_HEAD))
.toF("hazelcast-%sbar", HazelcastConstants.RINGBUFFER_PREFIX)
.to("seda:out");
-----------------------------------------------------------------------------------------------


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