Currently I have queue added to the Hazelcast member on run time with following way.
QueueConfig queueConfig = new QueueConfig();
queueConfig.setName(task.getKey());
hazelcastInstance.getConfig().addQueueConfig(queueConfig);
Now after adding the queue, I am able to push the items to the queue from client and in my consumer application. I am able to consume all items. I wanted to remove the entire QueueConfig
(Considering the queue won't be available in any member) after my tasks are completed.
I tried with follwoing way, but this throws UnsupportedExeption
from Hazelcast. hazelcastInstance.getConfig().getQueueConfigs().remove(key)
Could anyone provide any hint or way to remove the Iqueue
from the Hazelcast instance? I am really looking towards the solution and appreciate any help here.
Hazelcast Client only supports overriding or adding new configurations on the client-side. You can take a look at source code here https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/client/impl/clientside/ClientDynamicClusterConfig.java#L501 , which operations doesn't support in client-side.
To purge unused or empty queues after a period of time, use the
empty-queue-ttl
element. (programmatic way->queueConfig.setEmptyQueueTtl(TTL)
)
With above TTL config Hazelcast automatically purge empty queues after TTL expiration. I hope it helps.
Another solution is creating a new queue with your new configs if needed after your tasks in the queue are done.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.