【问题标题】:Setting activation config properties in MessageDrivenBeans dynamically在 MessageDrivenBeans 中动态设置激活配置属性
【发布时间】:2012-11-25 11:02:57
【问题描述】:

我在尝试让我们的 MDB 在不同环境中使用动态加载的属性时遇到了一些困难。

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "providerURL", propertyValue = "localhost:7001"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue ="javax.jms.Queue") }, mappedName = "jms.MyQueue", name = "MyQueueReader")
public class QueueReaderBean implements MessageListener {

}

我们希望在部署到不同环境时更改 providerURL。你有什么建议吗?

我们不想使用 ejb.xml,而是在构造函数或后构造方法中以编程方式进行。

谢谢

【问题讨论】:

    标签: java jms message-driven-bean


    【解决方案1】:

    可能和connecting to a remote JMS provider from a Message Driven Bean (MDB)这个条目有关

    并且使用带有 jnp 协议的 url 可以完成这项工作:

    @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "providerURL", propertyValue="jnp://hostname:1099"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }, mappedName = "jms.MyQueue", name = "MyQueueReader") 公共类 QueueReaderBean 实现 MessageListener {

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-02
      • 2018-08-28
      • 2010-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-11
      • 2011-07-22
      相关资源
      最近更新 更多