All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.ditto.connectivity.service.messaging.mqtt.hivemq.client.GenericMqttClientDisconnectedListener Maven / Gradle / Ivy

/*
 * Copyright (c) 2022 Contributors to the Eclipse Foundation
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.ditto.connectivity.service.messaging.mqtt.hivemq.client;

import com.hivemq.client.mqtt.lifecycle.MqttClientDisconnectedContext;

/**
 * Listener which is notified when a client is disconnected from a broker.
 */
@FunctionalInterface
public interface GenericMqttClientDisconnectedListener {

    /**
     * Listener method that is notified in the following cases:
     * 
    *
  • * A client was disconnected (with or without a Disconnect message, by the server, client or user) or the * connection failed. * The client state will still be {@link com.hivemq.client.mqtt.MqttClientState#CONNECTED} and the * {@link com.hivemq.client.mqtt.MqttClientConnectionConfig} will still be present. *
  • *
  • * A connect attempt by the user failed. * The client state will still be {@link com.hivemq.client.mqtt.MqttClientState#CONNECTING}. *
  • *
  • * A reconnect attempt by the client failed. * The client state will still be {@link com.hivemq.client.mqtt.MqttClientState#CONNECTING_RECONNECT}. *
  • *
* * The client state will be updated after all {@link GenericMqttClientDisconnectedListener}s are called to * *
    *
  • {@link com.hivemq.client.mqtt.MqttClientState#DISCONNECTED} or
  • *
  • * {@link com.hivemq.client.mqtt.MqttClientState#DISCONNECTED_RECONNECT} if the client is instructed to * reconnect. *
  • *
* * This method must not block. * If you want to reconnect you have to use the supplied {@link MqttClientDisconnectedContext#getReconnector()}. * * @param context context about the client that is now disconnected, the cause for disconnection and allow * reconnecting. * @param clientRole role of the client that is now disconnected. */ void onDisconnected(MqttClientDisconnectedContext context, ClientRole clientRole); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy