简体   繁体   中英

jBOSS EAP 7.3 Message Driven Bean fails to deploy app during Artemis failback

I am attempting to run two instances of JBoss EAP 7.3 in a cluster. Both instances are running 2 Artemis activemq servers, one which is live and one which backs up the live server on the other EAP instance. The live backup pairs are configured to use network replication to synchronize their data.

The issue I'm having is that my application will fail to deploy if the live Artemis instance needs to synchronise with the backup Artemis instance at startup (during failback). The errors I'm getting are:

"WFLYCTL0412: Required services that are not installed:" => [
        "jboss.naming.context.java.jboss.exported.jms.RemoteConnectionFactory",
        "jboss.ra.activemq-ra",
        "jboss.naming.context.java.jboss.DefaultJMSConnectionFactory"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
 

Shortly after getting these errors I can see the following messages in the logs:

WFLYJCA0002: Bound JCA ConnectionFactory [java:/JmsXA]

WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory

I believe Jboss is attempting to deploy my application before Artemis is ready. In the case of a failback the backup server (which became live) needs to replicate its state to the live server before it can start up. This will obviously take a little longer than a clean startup. I believe it is this extra time which is causing Artemis to startup later, and as a result the connection factories aren't available when the application is deployed.

It would be good if I would add dependency to MDB bean to indicate that it is dependent to java:jboss/DefaultJMSConnectionFactory.

This is MDB bean

@MessageDriven(activationConfig = {
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/exported/queue/siguard/serverQueue"),
    @ActivationConfigProperty(propertyName = "clientFailureCheckPeriod", propertyValue = "600000"),
    @ActivationConfigProperty(propertyName = "connectionTTL", propertyValue = "-1") })
public class ServerQueueListenerBean implements MessageListener {

@EJB
private ClientMessageHandlerLocal clientMessageHandler;

@EJB
private NodeMessageHandlerLocal nodeMessageHandler;

@EJB
private ServerMessageHandlerLocal serverMessageHandler;

private static final Logger logger = LoggingManager.getLogger(ServerQueueListenerBean.class);

/**
 * @see MessageListener#onMessage(Message)
 */
public void onMessage(Message message) {
    try {
        if (message instanceof ObjectMessage) {
            Object msgData = ((ObjectMessage)message).getObject();
            if (msgData instanceof NodeMessage) {
                NodeMessage nodeMessage = (NodeMessage)msgData;
                nodeMessageHandler.handleMessage(nodeMessage);
            } else if (msgData instanceof ClientMessage) {
                ClientMessage clientMessage = (ClientMessage)msgData;
                clientMessage.setInitiatorUID(message.getJMSCorrelationID());
                clientMessageHandler.handleMessage(clientMessage);
            } else if (msgData instanceof ServerMessage) {
                ServerMessage serverMessage = (ServerMessage)msgData;
                serverMessageHandler.handleMessage(serverMessage);
            } else {
                throw new Exception("Unexpected message content:" + msgData);
            }
        }
    } catch (Exception e) {
        logger.fatal(e);
    }

}

You can't deploy you application on the backup as the broker won't start until live goes down.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM