动态队列之Hazelcast队列配置
Hazelcast queue configuration of dynamic queues
我有一个创建动态队列的系统。这些队列在消息类型上都相似。
我的队列需要持久性,所以我实现了 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);
要使用相同的配置配置多个数据结构,您可以使用 config wildcards
和命名模式,如文档中所述:http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#using-wildcards
我有一个创建动态队列的系统。这些队列在消息类型上都相似。
我的队列需要持久性,所以我实现了 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);
要使用相同的配置配置多个数据结构,您可以使用 config wildcards
和命名模式,如文档中所述:http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#using-wildcards