如何使MDB激活规范上下文属性可配置? [英] How to make MDB Activation Spec contextual properties configurable?

查看:121
本文介绍了如何使MDB激活规范上下文属性可配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的项目中,我们正在使用MDB来侦听特定队列上的消息.它被定义为注释.

In our project, we are are using an MDB that listens for a message on a specific queue. It is defined as an annotation.

示例:

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20")})

.

为了更改maxSessions的值,必须每次都编译代码.即使我在ejb-jar.xml中配置它而不是将其配置为注释,也需要编译代码并生成EAR文件.

In order to change the value of the maxSessions, the code has to be compiled everytime. Even if i configure it in ejb-jar.xml instead of as an annotation , i need to compile the code and generate EAR file.

有没有一种方法可以使其用户可配置(从属性文件中读取),从而不需要重新编译代码,只需将maxSession值更改为"30"并重新启动jboss,它就可以正常工作.

Is there a way to make it user configurable(read from properties file) so that the recompilation of code is not required and by just changing the maxSession value to "30" and restarting the jboss, it should be working.

请帮助.

参考代码:

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "ABCQueue"),
@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20"),    @ActivationConfigProperty(propertyName="maxMessagesPerSessions",propertyValue="15")})
public class ABCMDB implements MessageListener
{
   ----------- 
}

推荐答案

我开始写有关Wildfly8和Websphere MQ集成的要点,允许为MDB或JMS消息生产者配置和维护环境上下文配置.

I started to write a gist about Wildfly8 and Websphere MQ integration, allowing to configure and maintain environment contextual configuration for MDB or JMS messages producers.

基本上,我必须在应用程序中声明一个jboss-ejb3.xml定制部署描述符,该描述符使用系统属性进行我的MDB使用的上下文配置.

Basically, I had to declare a jboss-ejb3.xml custom deployment descriptor in my application which use system properties for contextual configuration used by my MDB.

系统属性在wildfly standalone-full.xml文件中的system-properties元素下进行配置.因此,不在属性文件中,但在我看来,standalone-full.xml配置是进行此配置的理想位置.

System-properties are configured in wildfly standalone-full.xml file, under system-properties element. So not in a property file, but to my view standalone-full.xml configuration is a good location for such configuration.

这里是链接: https://gist.github.com/remibantos/33c366803f189db9b225

这篇关于如何使MDB激活规范上下文属性可配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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