【问题标题】:TomEE MDB Message Driven BeansTomEE MDB 消息驱动 Bean
【发布时间】:2017-06-13 07:00:26
【问题描述】:

是否可以在 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 参数传递值的正确方法是什么?

【问题讨论】:

    标签: java glassfish jms apache-tomee message-driven-bean


    【解决方案1】:

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

    简而言之:使用最新版本可以使用占位符

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-24
      • 2011-08-05
      • 1970-01-01
      • 1970-01-01
      • 2019-10-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多