动态队列的java Hazelcast队列配置
我有一个创建动态队列的系统。这些队列在消息类型上都是相似的
我需要队列中的持久性,所以我实现了一个QueueStore。问题是,要设置持久性,我需要知道队列的名称,并且这些名称是动态的。有没有办法给所有队列提供相同的配置?更好的是,必须基于队列名称的某些模式进行不同的配置
这就是我目前所拥有的
final QueueStoreConfig queueStoreConfig = new QueueStoreConfig()
.setFactoryImplementation(
(name, properties) -> new GenericQueueStore(name, properties)
);
final QueueConfig myQueueConfig = new QueueConfig()
.setName("myQueue")
.setQueueStoreConfig(queueStoreConfig);
final QueueConfig myQueueConfig2 = new QueueConfig()
.setName("myQueue2")
.setQueueStoreConfig(queueStoreConfig);
return new Config()
.addQueueConfig(myQueueConfig)
.addQueueConfig(myQueueConfig2);
# 1 楼答案
要使用相同的配置配置多个数据结构,可以使用
config wildcards
和命名模式,如文档中所述:http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#using-wildcards