繁体   English   中英

TomEE MDB消息驱动的Bean

[英]TomEE MDB Message Driven Beans

是否可以在MDB(消息驱动的Bean)中为“目标”动态分配运行时值?

基于注释的方法强制在MDB上对其进行硬编码

@MessageDriven(name="PingPongMDB", activationConfig = {
    @ActivationConfigProperty(
            propertyName = "destinationType", 
            propertyValue = "javax.jms.Queue"),
         @ActivationConfigProperty(
            propertyName = "destination", 
            propertyValue = "ref_fooQueue")})
public class PingPongMDB implements MessageListener {

我还尝试了ejb-jar.xml方法,但是将“ activation-config-property-name” =“ destination”的值读取为队列的字面物理名称。 因此,我无法对资源进行JNDI查找。

<message-driven>

  <ejb-name>PingPongMDB</ejb-name>
  <ejb-class>com.company.sample.services.PingPongMDB</ejb-class>

  <messaging-type>javax.jms.MessageListener</messaging-type>

  <activation-config>
    <activation-config-property>
      <activation-config-property-name>destination</activation-config-property-name>
      <activation-config-property-value>openejb:Resource/ref_fooQueue</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
      <activation-config-property-name>destinationType</activation-config-property-name>
      <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
    </activation-config-property>
  </activation-config>

</message-driven>

从属性读取和分配目标或使用-D参数传递值的正确方法是什么?

如果有人遇到它,可以在http://tomee-openejb.979440.n4.nabble.com/TomEE-override-parameterize-ActivationConfigProperty-td4680969.html上解决

简短的故事:使用最新版本可以使用占位符

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM