Search code examples
hazelcast

Hazelcast:: Set RingBuffer capacity in Client side


I am working on the hazelcast ringbuffer data structure.

If I set RingBuffer capacity in member then it is working fine. but I would like to set capacity on the client side based on user requirement. so is there any way to set capacity on the client side?


Solution

  • You can use dynamic configuration feature

    https://docs.hazelcast.org/docs/latest/manual/html-single/#dynamically-adding-data-structure-configuration-on-a-cluster

        HazelcastInstance client = HazelcastClient.newHazelcastClient();
        Config config = client.getConfig();
        config.addRingBufferConfig(new RingbufferConfig("foo").setCapacity(12345));
    
        Ringbuffer<Object> ringbuffer = client.getRingbuffer("foo");
    

    Remember that you cannot update/alter a current configuration but you can add new ones