Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jms 在Wildfly 10中,MDB查找属性是否可以在standalone-full.xml中指定,而不是在Java源代码的编译时绑定?_Jms_Wildfly_Activemq Artemis_Jboss Mdb - Fatal编程技术网

Jms 在Wildfly 10中,MDB查找属性是否可以在standalone-full.xml中指定,而不是在Java源代码的编译时绑定?

Jms 在Wildfly 10中,MDB查找属性是否可以在standalone-full.xml中指定,而不是在Java源代码的编译时绑定?,jms,wildfly,activemq-artemis,jboss-mdb,Jms,Wildfly,Activemq Artemis,Jboss Mdb,在Wildfly 10中,我想将MDB的一些注释移动到相关的资源适配器 据 可以对MDB进行如下注释(复制自引用页面): 有没有办法将查找决策从编译时推迟到调用时?我想在我的standalone-full.xml中指定属性“useJNDI”和“destination”的值 我尝试将MDB注释如下: @ResourceAdapter("my-remote") @MessageDriven(name = "MyMDB", activationConfig = { //try specifyi

在Wildfly 10中,我想将MDB的一些注释移动到相关的资源适配器

据 可以对MDB进行如下注释(复制自引用页面):

有没有办法将查找决策从编译时推迟到调用时?我想在我的standalone-full.xml中指定属性“useJNDI”和“destination”的值

我尝试将MDB注释如下:

@ResourceAdapter("my-remote")
@MessageDriven(name = "MyMDB", activationConfig = {
    //try specifying the next 2 properties in the configuration file  
    //@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),  
    //@ActivationConfigProperty(propertyName = "destination", propertyValue = "myQueue"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
})
public class MyMDB implements MessageListener {   
//       
}
<pooled-connection-factory name="my-remote" entries="jms/RemoteCF" 
    connectors="batch-connector" consumer-window-size="0"
    useJNDI="false" destination="myQueue"
    user="user" password="password" />
然后在standalone-full.xml中配置“my remote”,如下所示:

@ResourceAdapter("my-remote")
@MessageDriven(name = "MyMDB", activationConfig = {
    //try specifying the next 2 properties in the configuration file  
    //@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),  
    //@ActivationConfigProperty(propertyName = "destination", propertyValue = "myQueue"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
})
public class MyMDB implements MessageListener {   
//       
}
<pooled-connection-factory name="my-remote" entries="jms/RemoteCF" 
    connectors="batch-connector" consumer-window-size="0"
    useJNDI="false" destination="myQueue"
    user="user" password="password" />
是否必须在编译时指定查找属性?
如果我需要一个Wildfly实例使用jndi查找,另一个使用非jndi名称查找,那么我真的需要创建两个注释稍有不同的MDB吗?

实际上只是HornetQ JCA资源适配器顶部的一个门面,以方便配置。除了元素中标识的一组有限的配置属性(有关更多详细信息,请参阅架构),所有配置属性仅适用于出站适配器(即,它们不适用于使用入站适配器的MDB)。MDB使用的入站适配器实际上是要配置注释或部署描述符(即ejbjar.xml)

要实现您想要的,您可以将配置外部化到部署描述符,也可以在注释中使用系统属性替换。为了实现后者,您需要:

  • 在服务器配置中设置为true
  • 在服务器配置中设置为true
  • 在注释中使用${}语法,例如:

    @ActivationConfigProperty(propertyName = "destination", propertyValue = "${myDestinationProperty}")
    
  • 在服务器配置中定义相应的系统属性,例如:

    <system-properties>
        <property name="myDestinationProperty" value="myQueue"/>
    </system-properties>
    
    
    
  • 需要明确的是,在编译时并没有对注释进行任何处理。它们都是在MDB激活时在部署时读取的。

    实际上只是HornetQ JCA资源适配器顶部的一个门面,以方便配置。除了元素中标识的一组有限的配置属性(有关更多详细信息,请参阅架构),所有配置属性仅适用于出站适配器(即,它们不适用于使用入站适配器的MDB)。MDB使用的入站适配器实际上是要配置注释或部署描述符(即ejbjar.xml)

    要实现您想要的,您可以将配置外部化到部署描述符,也可以在注释中使用系统属性替换。为了实现后者,您需要:

  • 在服务器配置中设置为true
  • 在服务器配置中设置为true
  • 在注释中使用${}语法,例如:

    @ActivationConfigProperty(propertyName = "destination", propertyValue = "${myDestinationProperty}")
    
  • 在服务器配置中定义相应的系统属性,例如:

    <system-properties>
        <property name="myDestinationProperty" value="myQueue"/>
    </system-properties>
    
    
    

  • 需要明确的是,在编译时并没有对注释进行任何处理。当MDB激活时,它们都会在部署时读取。

    如果您的度假区适配器是在xml中配置的,您不需要任何MDB注释,除了@ResourceAdapter。如果您的度假区适配器是在xml中配置的,您不需要任何MDB注释,除了@ResourceAdapter。谢谢Justin。顺便说一句,我还必须在服务器配置中将jboss描述符属性替换设置为true。也许你可以把它添加到你的答案中。${}是否只能用于获取属性值,或者还可以指定条件表达式?可以使用冒号为属性指定默认值(例如${propertyName:defaultValue}),但${}语法不支持任何其他类型的表达式。谢谢Justin。顺便说一句,我还必须在服务器配置中将jboss描述符属性替换设置为true。也许你可以把它添加到你的答案中。${}是否只能用于获取属性值,或者还可以指定条件表达式?可以使用冒号为属性指定默认值(例如${propertyName:defaultValue}),但${}语法不支持任何其他类型的表达式。