How to configure MDB properties dynamically

A simple and effective way to configure the MDB properties dynamically with JBoss EAP and WildFly is via System Properties. All you have to do is coding your MDB Properties and then enable Property replacement:

import java.util.logging.Logger;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

@MessageDriven(name = "HelloWorldQueueMDB", activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "${property.hello.queue}"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})
public class HelloQueueMDB implements MessageListener {

    public void onMessage(Message rcvMessage) {
        TextMessage msg = null;
        try {
            if (rcvMessage instanceof TextMessage) {
                msg = (TextMessage) rcvMessage;
                System.out.println("Received Message from queue: " + msg.getText());
            } else {
                System.out.println("Wrong type of message: " + rcvMessage.getClass().getName());
        } catch (JMSException e) {
            throw new RuntimeException(e);

Now before deploying the MDB, you need to configure the “ee” subsystem to enable MDB annotation property substitution and set the properties needed by the MDB. From the CLI: