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

com.hivemq.spi.services.BlockingClientService Maven / Gradle / Ivy

There is a newer version: 3.4.4
Show newest version
/*
 * Copyright 2014 dc-square GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hivemq.spi.services;

import com.hivemq.spi.annotations.Nullable;
import com.hivemq.spi.security.ClientData;

import java.util.Set;

/**
 * Through this client service a plugin can query details about connected or disconnected clients (with a persistent session) from the HiveMQ core.
 *
 * @author Lukas Brandl
 * @since 3.1
 */
public interface BlockingClientService {

    /**
     * Returns all identifiers of connected clients of this HiveMQ Node. You won't receive client identifiers of connected
     * clients from other HiveMQ nodes if HiveMQ runs in a cluster.
     * 

* If you have many client connections, please note that calling this method frequently could have negative performance * effects. * * @return client identifiers of all connected clients */ Set getLocalConnectedClients(); /** * Returns all disconnected clients which have a persistent MQTT session on this instance of HiveMQ (MQTT clean session=false). *

* Disconnected MQTT clients which don't have a persistent session won't be returned by this method * * @return all disconnected clients with a persistent MQTT session */ Set getLocalDisconnectedClients(); /** * Check if a client with a given identifier is currently connected to this HiveMQ instance. * * @param clientId client, which should be checked * @return true, if a certain client is currently connected and false otherwise */ boolean isClientConnectedLocal(String clientId); /** * Returns client information for clients that are connected to this broker instance. *

* If the client isn't connected, null will be returned. * * @param clientId the client identifier of the client * @return {@link ClientData} for a specific client or null if the client is not connected */ @Nullable ClientData getLocalClientData(String clientId); /** * Returns all identifiers of connected clients of this HiveMQ instance and all other nodes in a HiveMQ cluster *

* Calling this method frequently in a clustered environment could have negative performance effects. * * @return client identifiers of all connected clients */ Set getConnectedClients(); /** * Returns all disconnected clients which have a persistent MQTT session on this broker or any other cluster node. *

* Disconnected MQTT clients which don't have a persistent session won't be returned by this method * * @return all disconnected clients with a persistent MQTT session */ Set getDisconnectedClients(); /** * Check if a client with a given identifier is currently connected to this HiveMQ broker instance or any other instance in the cluster. * * @param clientId client, which should be checked * @return true, if a certain client is currently connected and false otherwise */ boolean isClientConnected(String clientId); /** * Returns additional client information about a given client with a given client identifier. *

* This method will also get client information from other cluster nodes if needed. *

* If the client isn't connected, null will be returned. * * @param clientId the client identifier of the client * @return {@link ClientData} for a specific client or null if the client is not connected */ @Nullable ClientData getClientData(String clientId); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy