Esempio n. 1
0
 public void connectionFailed(HornetQException e, boolean failedOver) {
   if (failedOver) {
     logger.info("reconnected to yamcs: {}", e.getMessage());
     for (ConnectionListener cl : connectionListeners) {
       cl.connected(connParams.getUrl());
     }
   } else {
     logger.warn("connection to yamcs failed: {}", e.getMessage());
     for (ConnectionListener cl : connectionListeners) {
       cl.connectionFailed(connParams.getUrl(), new YamcsException(e.getMessage(), e));
       cl.log(e.getMessage());
     }
   }
 }
Esempio n. 2
0
  public void beforeReconnect(HornetQException e) {
    logger.warn("disconnected from yamcs: {}", e.getMessage());
    for (ConnectionListener cl : connectionListeners) {
      cl.disconnected();
      cl.log(e.getMessage());
    }

    // clear all pending messages in the data consumers, as they will be re-submitted
    // by yamcs upon re-connect
    for (ClientConsumer consumer : dataConsumers) {
      try {
        MessageHandler handler = consumer.getMessageHandler();
        if (handler instanceof ClientAckMessageHandler) {
          ((ClientAckMessageHandler) handler).clearPendingMessages();
        }
      } catch (HornetQException e1) {
        // ignore
      }
    }
  }