动态更改jmsSelector [英] Dynamically change jmsSelector

查看:78
本文介绍了动态更改jmsSelector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用从配置文件读取的属性来填充JMS选择器中的propertyValue? 例如,我有:

Is there a way to use a property read from a config file to fill propertyValue in JMS selector? As an example I have:

@ActivationConfigProperty(propertyName = "messageSelector", propertyValue = 
JMSSelector.ITEM_SELECTOR)

其中JMSSelector.ITEM_SELECTOR是一个字符串,定义为:

Where JMSSelector.ITEM_SELECTOR is a String defined as:

public static final String ITEM_SELECTOR = "type = 'S_TYPE' OR type  = 'M_TYPE'"

假设我除了"S_TYPE"和"M_TYPE"之外还有另一种新类型,并且在配置文件中有它

Let's say that I have another new type other than "S_TYPE" and "M_TYPE", and I have it in a config file

MYTYPES = S_TYPE,M_TYPE,G_TYPE

有没有一种方法可以动态加载它,而无需修改我的代码并重新部署它?

Is there a way to load it dynamically without modifying my code and redeploy it?

推荐答案

我将回答我自己的问题,因为jmsselector字符串是静态的,所以没有找到从配置文件中进行动态读取的方法.否则我发现了这个 https://timjansen.github.io/jarfiller/guide/jms/selectors. xhtml ,而我的解决方案是

I'll answer my own question, I didn't find a way to dinamically read from a config file because jmsselector String is static. Otherwise I found this https://timjansen.github.io/jarfiller/guide/jms/selectors.xhtml and my solution is

public static final String ITEM_SELECTOR = "'tipe LIKE '%_TYPE'"

希望有人会满意

这篇关于动态更改jmsSelector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆