In Wildfly 10, I'd like to move some of the annotations of an MDB to the associated resource adapter.
According to Connect a pooled-connection-factory to a Remote Artemis Server one could annotate the MDB as follows (copied here from the referenced page):
@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 {
//
}
Is there any way to defer the lookup decision from compile time to invocation time? I'd like to specify the values of the properties "useJNDI" and "destination" in my standalone-full.xml
I tried annotating the MDB as follows:
@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 {
//
}
And then configured "my-remote" in the standalone-full.xml as follows:
<pooled-connection-factory name="my-remote" entries="jms/RemoteCF"
connectors="batch-connector" consumer-window-size="0"
useJNDI="false" destination="myQueue"
user="user" password="password" />
But getting the following error message:
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'
Do the lookup properties have to be specified at compile time?
If I have a need for one Wildfly instance to lookup using jndi and another using the non-JNDI name, do i really have to create two MDB's that are just annotated slightly differently?