Dynamically change jmsSelector

谁都会走 提交于 2019-12-24 22:18:28

问题


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)

Where JMSSelector.ITEM_SELECTOR is a String defined as:

public static final String ITEM_SELECTOR = "type = 'S_TYPE' OR 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?


回答1:


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'"

hope someone will be pleased



来源:https://stackoverflow.com/questions/48868136/dynamically-change-jmsselector

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!