在 Wildfly 10 中,我想将 MDB 的一些注释移动到关联的资源适配器。
根据Connect a pooled-connection-factory to a Remote Artemis Server ,可以如下注释 MDB(从引用的页面复制到此处):
@ResourceAdapter("remote-artemis")
@MessageDriven(name = "MyMDB", activationConfig = {
@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 {
//
}
有没有办法将查找决定从编译时间推迟到调用时间?我想在我的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 {
//
}
然后在standalone-full.xml中配置“my-remote”如下:
<pooled-connection-factory name="my-remote" entries="jms/RemoteCF"
connectors="batch-connector" consumer-window-size="0"
useJNDI="false" destination="myQueue"
user="user" password="password" />
但收到以下错误消息:
Message: WFLYCTL0376: Unexpected attribute 'useJNDI' encountered. Valid attributes are: 'entries, discovery-group, connectors, ha, client-failure-check-period, connection-ttl, call-timeout, call-failover-timeout, consumer-window-size, consumer-max-rate, confirmation-window-size, producer-window-size, producer-max-rate, protocol-manager-factory, compress-large-messages, cache-large-message-client, min-large-message-size, client-id, dups-ok-batch-size, transaction-batch-size, block-on-acknowledge, block-on-non-durable-send, block-on-durable-send, auto-group, pre-acknowledge, retry-interval, retry-interval-multiplier, max-retry-interval, reconnect-attempts, failover-on-initial-connection, connection-load-balancing-policy-class-name, use-global-pools, scheduled-thread-pool-max-size, thread-pool-max-size, group-id, transaction, user, password, min-pool-size, use-auto-recovery, max-pool-size, managed-connection-pool, enlistment-trace, initial-message-packet-size, initial-connect-attempts'
是否必须在编译时指定查找属性?
如果我需要一个 Wildfly 实例使用 jndi 查找另一个使用非 JNDI 名称,我真的需要创建两个只是注释略有不同的 MDB 吗?