2

I have the following MDB configuration

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destinationJndiName", propertyValue = "jms/test/log"),
@ActivationConfigProperty(propertyName= "destination", propertyValue="jms_test_log"),
@ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge"),    
@ActivationConfigProperty(propertyName="addressList", propertyValue="mq://test.server.co.uk:7676"),
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
})

@TransactionManagement(TransactionManagementType.BEAN)
public class DownloadListener implements MessageListener { ....

I wish to be able to set addressList property dynamically. The values will be from an initial setup properties files and from a future admin console. As it is out of the class decleration I am unable to simply assign a variable.

I have seen that you can add these values into an xml file of sorts but it seems to be vendor dependant e.g. JBoss. I don't want to strap this down to one vendor. I need it to open in that way.

I have looked around and I am unable to find anything that suggests I could do such a thing. Is it possible to set up the configuration in something like a setup method?

Softey
  • 1,451
  • 3
  • 21
  • 42

1 Answers1

2

No, there is no standard way to dynamically set activation config properties. I've never even heard of a vendor-specific way to dynamically set activation configuration properties. I suppose you could dynamically rebuild the EAR and redeploy it using vendor-specific APIs, or perhaps some application server supports dynamically overriding that configuration.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
  • Thank you for the response. By vendor specific I meant within the ejb-jar.xml. I thought JBoss would need a set tag to work properly. Can I not set the MDB properties inside the code? I imagine the problem is that the annotation is used to setup the MDB inside the container and being able to modify it in the code would require the MDB to be re-deployed. At least all I want to do is to read a destination from a properties file that a user has set instead of hardcodeing the value. – Softey Jan 21 '16 at 14:18
  • I'm not familiar enough with JBoss to answer, but I would be surprised if there is a way to do this (easily) with code. Typically, you would configure this in the application server, not in the application. For example, for WebSphere Application Server, you would configure addressList in the activation spec rather than in the MDB. – Brett Kail Jan 21 '16 at 17:01