API for ORG.ECLIPSE.PAHO.CLIENT.MQTTV3

Source: Internet
Author: User
Tags cipher suite

The package structure of ORG.ECLIPSE.PAHO.CLIENT.MQTTV3 is as follows:

Org.eclipse.paho.client.mqttv3Interfaces Imqttactionlistener imqttasyncclient imqttclient Imqttdeliverytoken    Mqttmessagelistener imqtttoken mqttcallback mqttcallbackextended mqttclientpersistence MqttPersistable Mqttpingsenderclasses bufferedmessage disconnectedbufferoptions mqttasyncclient MqttClient MqttConnectOpti ONS mqttdeliverytoken mqttmessage mqtttoken mqtttopic timerpingsenderexceptions mqttexception MqttPer Sistenceexception MqttSecurityExceptionorg.eclipse.paho.client.mqttv3.internalInterfaces Destinationprovider Idis Connectedbuffercallback networkmoduleclasses clientcomms clientdefaults clientstate CommsCallback CommsR     Eceiver commssender commstokenstore Connectactionlistener disconnectedmessagebufferexceptionhelper FileLock Localnetworkmodule messagecatalog mqttpersistentdata resourcebundlecatalog sslnetworkmodule TCPNetworkM Odule tokenorg.eclipsE.paho.client.mqttv3.internal.securityclasses Simplebase64encoder SSLSocketFactoryFactoryorg.eclipse.paho.client.mqttv3.internal.websocketClasses Base64 Websocketframe Websocketha Ndshake websocketnetworkmodule websocketreceiver websocketsecurenetworkmoduleexceptions HandshakeFailedExcepti Onorg.eclipse.paho.client.mqttv3.internal.wireClasses countinginputstream mqttack mqttconnack mqttconnect M Qttdisconnect mqttinputstream mqttoutputstream mqttpersistablewiremessage mqttpingreq MqttPingResp MqttP Uback mqttpubcomp mqttpublish mqttpubrec mqttpubrel mqttreceivedmessage mqttsuback MqttSubscribe M Qttunsuback mqttunsubscribe mqttwiremessage multibytearrayinputstream MultiByteIntegerorg.eclipse.paho.client. Mqttv3.logginginterfaces loggerclasses Jsr47logger loggerfactory SIMPLELOGFORMATTERORG.ECLIPSE.PAHO.CLIENT.MQT Tv3.persistclasses memorypersistence MQTTDEFAULTFILEPERSISTENCEORG.EClipse.paho.client.mqttv3.utilClasses Debug Strings 

 ORG.ECLIPSE.PAHO.CLIENT.MQTTV3-----Interfaces-----imqttactionlistener void onsuccess (Imqtttoken asyncactiontoken) void OnFailure (Imqtttoken asyncactiontoken, java.lang.Throwable exception) when an asynchronous operation completes, the implementation of the interface is notified.        Listeners are registered on Mqtttoken, and tokens are associated with operations such as connection or publishing. When used with tokens on mqttasyncclient, the listener is called back on the Mqtt client's thread.        If the operation succeeds or fails, the listener is notified. The Listener quick return control is important, otherwise the operation of the MQTT client will stop. The Imqttasyncclient implements Imqttasyncclient enables applications to communicate with the MQTT server using a non-blocking method. Using non-blocking clients allows applications to use a mixture of blocking and non-blocking styles. Imqttclient uses blocking clients to only allow applications to use one style. Blocking clients provide compatibility with earlier versions of MQTT clients.        Imqttdeliverytoken extends Imqtttoken imqtttoken, tracing the delivery of messages. Unlike instances of Imqtttoken delivery tokens, they can be used when connecting and client restarts. This allows you to track messages after a failed send. Imqttmessagelistener the implementation of this interface is notified when a message arrives. Imqtttoken provides a mechanism for tracking the completion of asynchronous tasks. Mqttcallback enables the application to be notified when a client-related asynchronous event occurs. Classes that implement this interface can be registered on two types of clients: Imqttclient.setcallback (Mqttcallback) and Imqttasyncclient.setcallback (mqttcallback) void con    Nectionlost (java.lang.Throwable Cause) This method is called when a connection to the server is lost. VoiddeliverycomPlete (Imqttdeliverytoken token) is called when the message delivery is complete, and all acknowledgments have been received. Voidmessagearrived (java.lang.String topic, Mqttmessage Message) This method is called when a message arrives from the server. The mqttcallbackextended extends Mqttcallback expands mqttcallback to allow new callbacks without disrupting the APIs of existing applications. Classes that implement this interface can be registered on two types of clients: Imqttclient.setcallback (Mqttcallback) and Imqttasyncclient.setcallback (Mqttcallback) voidconn    Ectcomplete (Boolean reconnect, Java.lang.String Serveruri) is called when the connection to the server completes successfully. Inherited methods Connectionlost, Deliverycomplete, messagearrivedmqttclientpersistence represent a persistent data store that stores outbound and inbound messages for delivery to the specified QoS         。 You can use Mqttclient.mqttclient (string, String, mqttclientpersistence) to specify the implementation of the interface,
Mqttclient will use this mqttclient to maintain QoS 1 and 2 messages. If the defined method throws Mqttpersistenceexception, the persisted state of the data should remain in the state before the method being called. For example, if a put (String, mqttpersistable) throws an exception at any time, the data is assumed not to be in persistent storage. Similarly, if remove (String) throws an exception, the data is considered to still be stored in the persistent store. Persistent interfaces are recorded by any exception or error message that may be required to diagnose a persistent failure. Mqttpersistable represents an object that is used to pass data to persist on the Mqttclientpersistence interface. When data is passed through an interface, the title and payload are separated to avoid unnecessary copies of the message. Mqttpingsender represents the object that each keep-active interval is used to send ping packets to the MQTT agent. Voidinit (Clientcomms comms) Initial method. Voidschedule (long delayinmilliseconds) schedules the next ping at a certain delay. Voidstart () starts pinging the sender. Voidstop () stops the ping sender. ========= Classes ========bufferedmessage A bufferedmessage contains a mqttwire message and token, It allows buffering of messages and tokens when the client is at rest disconnectedbufferoptions save an option set for managing offline (or disconnected) buffered message behavior mqttasyncclient Lightweight client, using a non-blocking method that allows operations to run in the background with Mqtt server interaction. By default, messages are stored in a file using Mqttdefaultfilepersistence. If you set the persistence to NULL, the message is stored in memory. Mqttclient implements Imqttclient lightweight client that interacts with the MQTT server in a way that is done with blocking operations. Mqttconnectoptions saves a set of options that control the client's connection to the server. Static Booleanclean_session_default If you do not specify a default cleanup session setting of static Intconnection_timeout_default if you do not specify a default connection time-out (in seconds) Static Intkeep_alive_interval_default if not specified, the default active time interval in seconds is static Intmax_inflight_default if not specified, the default is the maximum voyage St atic intmqtt_version_3_1 static intmqtt_version_3_1_1 static Intmqtt_version_default first default mqttversion is 3.1.1, if failed , the return to the 3.1MqttDeliveryToken extends Mqtttoken implements Imqttdeliverytoken provides a mechanism for tracking the progress of the message delivery. Used to track the sending progress of messages in a non-blocking manner (running in the background). Mqttmessage MQTT messages contain application payloads and options that specify how messages are delivered. The message contains a "payload" (message body) expressed as a byte []. The Mqtttoken implements Imqtttoken provides a mechanism to track the completion of asynchronous operations. Tokens that implement the Imqtttoken interface are returned from all non-blocking methods, except for the publication. Mqtttopic represents the subject target for publish/subscribe messaging. Timerpingsender implements Mqttpingsender default Ping sender executes this class to implement the Imqttpingsender pinger interface, allowing the application to be imqttpingsender at each active time interval The server sends ping packets. = = Exceptions ====mqttexceptionn extends Exceptionmqttpersistenceexception extends Mqttexceptionmqttsecurityexception extends mqttexception=========================================----------- Org.eclipse.paho.client.mqttv3.internal-----------------======== Interfaces ========destinationprovider This interface can be used as M Qttclient and mqttmidpclient are a common type, so they can be passed to Clientcomms without requiring the client class to know about the other. Specifically, this allows MIDP clients to work without the non-MIDP mqttclient/mqttconnectoptions class. Mqtttopicgettopic (java.lang.String topic) Idisconnectedbuffercallback voidpublishbufferedmessage (bufferedmessage Bufferedmessage) Networkmodule Java.io.InputStreamgetInputStream () Java.io.OutputStreamgetOutputStream () Java.lang.StringgetServerURI () Voidstart () voidstop () ======== Classes ========clientcomms handles client communication with the server. Send and receive MQTT V3 messages. Clientdefaults public static final int max_msg_size = 1024 * 1024 * 256; The core of the Mbclientstate client, which holds status information for pending and in-progress messages. Messages that have been sent are moved between several objects at the same time that they are delivered. 1) When the client is not running, the message is stored in a persistent store that implements the Mqttclientpersistent interface. The default is Mqttdefaultfilepersistencew, which can safely store messages across failures and system restarts. If persistence is not specified, it is returned to Memorypersistence, which maintains the message when the MQTT client instantiates. 2) When the client or a specific clientstate is instantiated, the message is read from the persistence store to:-OutbounDqos2 Hashtable if QoS 2 PUBLISH or PUBREL-OUTBOUNDQOS1 hash table if QoS 1 PUBLISH (see Restorestate) 3) on Connect, copy messages in MessageID order to add outbound hash tables To the pendingmessages or pendingflows vectors. -The initial message is published into the pendingmessages buffer. -Pubrel into the pending buffer (see Restoreinflightmessages) 4) The sender thread reads the message from the pending stream and the pending message buffer. The message is removed from Pendingbuffer, but remains in the outbound * hash table. A hash table is where all of the unfinished messages are stored in memory. (Persistence only used at startup) 5) receiver thread-receive a wired message:-If QoS 1 is removed from persistence, OUTBOUNDQOS1-if QoS 2 Pubrec sends Pubrel. Update the OUTBOUNDQOS2 entry with Pubrel and update the persistence. -If QoS 2 Pubcomp is removed from persistence and Outboundqos2 Note: Because of the multithreading nature of the client, any modification to this class takes into account concurrency as critical. For example, as long as the traffic/message is placed on the line, the receiving thread can receive the acknowledgment and process the response before the sender finishes processing. For example, the connection may be sent, and the Conack received before the connection notification is sent has been processed! Commscallback implements Runnable receiver and the external API bridge. This class is called by receiver and then translates the communication-centric MQTT message object into an object that is understood by the external API. Commsreceiver implements Runnable receives MQTT packets from the server. Commssender implements Runnablecommstokenstore provides a "token-based" system to store and track operations across multiple threads. When a message is sent, the token is associated with the message and is saved using the Savetoken (Mqtttoken, Mqttwiremessage) method. Anyone interested in this state can invoke a wait method on the token, or use the asynchronous listener callback method on the operation. The Commsreceiver class on another thread reads the response from the network. It uses a ringingYou should find the relevant token, and then you can notify it. Note: Ping, connect and disconnect do not have a unique message ID, because only one pending request for each type is allowed to not complete Connectactionlistener implements Imqttactionlistener This class handles asyncclient connections to an available URL. These URLs are provided as a singleton when the client is created, or as a list in connection options. This class uses its own onsuccess and onfailure callbacks to take precedence over user-provided callbacks. Attempts to connect to each URL in the list until the connection attempt succeeds or all URLs are attempted if the connection succeeds, the user token is notified and the user onsuccess callback is called. If the connection fails, try another URL in the list, otherwise the user token is notified, and the user OnFailure callback Voidconnect () starts the connection processing voidonfailure (Imqtttoken token, java.lang.t Hrowable exception) connection failed, try the next URI in the list. Voidonsuccess (Imqtttoken token) If the connection succeeds, call the user onsuccess callback voidsetmqttcallbackextended (mqttcallbackextended MqttCall backextended) Set mqttcallbackextened callback to receive ConnectComplete callback Disconnectedmessagebuffer implements The Runnableexceptionhelper tool class helps to create the correct type of exception. Filelocklocalnetworkmodule implements Networkmodule special Comms class that allows an MQTT client to use a non-TCP/ Optimization mechanism to talk to the MQTT server. This class checks for the existence of an optimized communication protocol class, that is, a class that provides an optimized communication mechanism. If it is not available, the request to connect using the optimization mechanism is rejected. The only known server to achieve this is the Micro broker:-an MQTT server that is provided with many IBM products. Public abstract class MessagecatAlog private static Messagecatalog INSTANCE = null; Human readable directory of error messages. Mqttpersistentdata implements Mqttpersistableresourcebundlecatalog extends Messagecatalogsslnetworkmodule extends The tcpnetworkmodule is used for network modules that are connected over SSL. Tcpnetworkmodule implements Networkmodule a network module that is connected via TCP. token==============================org.eclipse.paho.client.mqttv3.internal.security=========================== ===classessimplebase64encoder private static final String pwdchars_string = ". 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ ";p rivate static final char[] Pwdchars_array = Pwdchars_string.tochararray (); public static string encode (byte[] bytes) public static byte[] Decode (string string) private final static string To6 4 (long input, int size) Private final static long from64 (byte[] encoded, int idx, int size) Sslsocketfactoryfactory a A sslsocketfactoryfactory provides a socket factory and a server socket factory, which can then be used to create SSL client sockets or SSL server sockets. Sslsocketfactoryfactory is configured with the IBM SSL attribute, which is in the format "Com.ibm.ssl."PropertyName properties, such as "Com.ibm.ssl.keyStore". This class supports multiple configurations, each of which is identified by a name or configuration ID. Use the configuration ID of "NULL" as the default configuration. When you create a socket factory for a given configuration, the properties of that configuration are selected first. If a property is not defined there, the property is found in the default configuration. Finally, if a property element has not been found, the corresponding system property, Javax.net.ssl.keyStore, is checked. If the system properties are not set, use the system's default value (if available) or throw an exception. Sslsocketfacotryfactory can be reconfigured at any time. Reconfiguration does not affect existing socket factories. All properties share the same key space; That is, the configuration ID is not part of the property key. The method should be called in the following order: ISSUPPORTEDONJVM (): Checks if this class is supported on the runtime platform. Not all runtimes support SSL/TLS. Sslsocketfactoryfactory (): constructor. The client (in the same JVM) may share a sslsocketfactoryfactory, or each has one. Initialize (Properties,configid): Initializes this object with the required SSL properties for the configuration. This may be called multiple times, each time it needs to be configured. It may be called again to change the SSL properties required for a specific configuration getenabledciphersuites (Configid): Set the Enabled cipher suite on the socket later [see below]. For MQTT server: Getkeystore (configid): Or, to check if there is no keystore, all enabled cipher suites are anonymous. Createserversocketfactory (Configid): Create a sslserversocketfactory. Getclientauthentication (Configid): Set whether client authentication is required later on Sslserversocket (itself created from sslserversocketfactory). For MQTT client: Createsocketfactory (configid): Create a sslsocketfactory. ================================org.eclipse.paho.client.mqttv3.internal.websocket==== Classes ====base64private static final Base64 instance = new Base64 (); Private static final Base64encoder encoder = instance.new Base64encoder (); public static string encode (string s) public static string Encodebytes (byte[] b) public class Base64encoder Extend s abstractpreferenceswebsocketframe public class Websockethandshake public class. The helper class executes the websocket handshake. Websocketnetworkmodule extends Tcpnetworkmodulewebsocketreceiver implements Runnablewebsocketsecurenetworkmodule Extends sslnetworkmodule==== Exceptions ====handshakefailedexception extends exception{private static final long Serialversionuid = 1L; }==============================org.eclipse.paho.client.mqttv3.internal.wire================================== Classes ====countinginputstream extends InputStream counts the input stream of bytes read from. Private InputStream in;private int counter; Public Countinginputstream (InputStream in) public int read () throws IOException public int getcounter () {return counter;} public void Resetcounter () {counter = 0;} Mqttack extends mqttwiremessage an abstract superclass of all acknowledgment messages. Public Mqttack (byte type) {super (type);} protected byte Getmessageinfo () {return 0;} Mqttconnack extends Mqttack an online representation of MQTT Connack. public static final String KEY = "Con"; private int ReturnCode; Private Boolean sessionpresent; Mqttconnect extends Mqttwiremessageprivate String clientid;private boolean cleansession;private mqttmessage Willmessage;private string username;private char[] password;private int keepaliveinterval;private String willdestination;private int mqttversion; Mqttdisconnect extends Mqttwiremessagemqttinputstream extends InputStream a mqttinputstream let the application read the Mqttwiremessage instance. private static final String class_name = MqttInputStream.class.getName ();p rivate static final Logger log = Loggerfactory . GetLogger (Loggerfactory.mqtt_client_msg_cat, class_name);p rivate clientstate clientstate = null;private DataInputStream in; Mqttoutputstream extends OutputstreAm a Mqttoutputstream lets the application write Mqttwiremessage instances. private static final String class_name = MqttOutputStream.class.getName ();p rivate static final Logger log = Loggerfactory. GetLogger (Loggerfactory.mqtt_client_msg_cat, class_name);p rivate clientstate clientstate = null;private Bufferedoutputstream out; Mqttpersistablewiremessage extends Mqttwiremessageimplements Mqttpersistablemqttpingreq extends MQTTWIREMESSAGEMQTTPINGRESP extends Mqttackmqttpuback extends Mqttackmqttpubcomp extends Mqttackmqttpublish extends Mqttpersistablewiremessagemqttpubrec extends Mqttackmqttpubrel extends Mqttpersistablewiremessagemqttreceivedmessage extends Mqttmessagemqttsuback extends Mqttackmqttsubscribe extends Mqttwiremessagemqttunsuback extends Mqttackmqttunsubscribe extends Mqttwiremessagepublic abstract class Mqttwiremessagemultibytearrayinputstream extends inputstreamprivate byte[] bytesa;private int offsetA;private int Lengtha;private byte[] bytesb;private int offsetb;private int lengthb;private intpos = 0;public multibytearrayinputstream (byte[] bytesa, int offsetA, int lengtha, byte[] bytesb, int offsetB, int lengthb) The {} public int read () throws ioexception{}multibyteinteger represents the multibyte integer (MBI) defined by the MQTT V3 specification. Private long value;private int length; Public Multibyteinteger (Long value) public Multibyteinteger (Long value, int length) public int getencodedlength () Public long GetValue () ========================org.eclipse.paho.client.mqttv3.logging============================ Interfaces ====logger==== Classes ====jsr47logger implements Logger implementation using the Java.uti.logging logger interface logger with Java built-in logging tool-ja Va.util.logging. Provides a sample java.util.logging properties file-Jsr47min.properties, which demonstrates how to run with the memory-based trace tool, which runs with minimal performance overhead. The memory buffer can be dumped when the record/trace record is written to match the Memoryhandler trigger level or when the push method is raised on Memoryhandler. The method provided by debug makes it easy to dump memory buffers and other useful debugging information. Loggerfactory a factory that returns a logger for use by MQTT clients. The default log and trace tools are built using Java in the Log tool:-java.util.logging. For systems that are not available or that require a replacement for the log framework, you can use Setlogger (String) to replace the logging tool, which requires implementing the Logger interface. SimplelogfoRmatter extends Formatter print single-line logging in a readable form. ========================org.eclipse.paho.client.mqttv3.persist==== Classes ====memorypersistence Implements Mqttclientpersistence use of memory persistence can be used when the client or device does not require reliability to restart memory. In situations where reliability is required, such as when the clean session is set to False, the persistence in non-volatile form should be used. The Mqttdefaultfilepersistence implements Mqttclientpersistence provides the implementation of the Mqttclientpersistence interface based on file persistence. Specifies a directory when the persistence object is created. When persistence is turned on (see Open (String, String)), create a subdirectory on the basis of this client ID and connection key. This allows a persistent base directory to be shared by multiple customers. The name of the subdirectory is created by connecting the client ID and connection key with any instance of '/', ' \ \ ', ': ' or '. ========================org.eclipse.paho.client.mqttv3.util==== Classes ====debug to help debug PAHO A utility for MQTT client issues once the call to Dumpclientdebug is initialized, any memory traces are forced to be loaded with the associated client and system State to the main log facility. When a dump is in progress, the client wide lock is not performed. This means that the collection of client states may be inconsistent because the client may still be working on the process during the dump. Strings String Helper ========= END ===========

API for ORG.ECLIPSE.PAHO.CLIENT.MQTTV3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.