当前位置: 首页>>代码示例>>Java>>正文


Java IMqttClient.getClientId方法代码示例

本文整理汇总了Java中org.eclipse.paho.client.mqttv3.IMqttClient.getClientId方法的典型用法代码示例。如果您正苦于以下问题:Java IMqttClient.getClientId方法的具体用法?Java IMqttClient.getClientId怎么用?Java IMqttClient.getClientId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.paho.client.mqttv3.IMqttClient的用法示例。


在下文中一共展示了IMqttClient.getClientId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MqttV3Receiver

import org.eclipse.paho.client.mqttv3.IMqttClient; //导入方法依赖的package包/类
/**
 * @param mqttClient
 * @param reportStream
 */
public MqttV3Receiver(IMqttClient mqttClient, PrintStream reportStream) {
  String methodName = Utility.getMethodName();
  log.entering(className, methodName);

  this.reportStream = reportStream;
  connected = true;

  clientId = mqttClient.getClientId();

  log.exiting(className, methodName);
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:16,代码来源:MqttV3Receiver.java

示例2: testConnect

import org.eclipse.paho.client.mqttv3.IMqttClient; //导入方法依赖的package包/类
/**
 * @throws Exception 
 */
public void testConnect() throws Exception {

  IMqttClient client = null;
  try {
    String clientId = "testConnect";

    client = new MqttClient(serverURI, clientId);
    System.out.println("Connecting...(serverURI:" + serverURI + ", ClientId:" + clientId);
    client.connect();

    String clientId2 = client.getClientId();
    System.out.println("clientId = " + clientId2);

    boolean isConnected = client.isConnected();
    System.out.println("isConnected = " + isConnected);

    String id = client.getServerURI();
    System.out.println("ServerURI = " + id);

    client.disconnect();
    System.out.println("Disconnecting...");

    client.connect();
    System.out.println("Re-Connecting...");

    client.disconnect();
    System.out.println("Disconnecting...");
  }
  catch (MqttException exception) {
    System.out.println("Unexpected exception: " + exception);
  }
  finally {
    if (client != null) {
  	System.out.println("Close...");
      client.close();
    }
  }
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:42,代码来源:BasicSyncTestCaseMIDP.java

示例3: testConnect

import org.eclipse.paho.client.mqttv3.IMqttClient; //导入方法依赖的package包/类
/**
 * @throws Exception 
 */
@Test
public void testConnect() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);

  IMqttClient client = null;
  try {
    String clientId = methodName;
    client = clientFactory.createMqttClient(serverURI, clientId);

    log.info("Connecting...(serverURI:" + serverURI + ", ClientId:" + clientId);
    client.connect();

    String clientId2 = client.getClientId();
    log.info("clientId = " + clientId2);

    boolean isConnected = client.isConnected();
    log.info("isConnected = " + isConnected);

    String id = client.getServerURI();
    log.info("ServerURI = " + id);

    log.info("Disconnecting...");
    client.disconnect();

    log.info("Re-Connecting...");
    client.connect();

    log.info("Disconnecting...");
    client.disconnect();
  }
  catch (MqttException exception) {
    log.log(Level.SEVERE, "caught exception:", exception);
    Assert.fail("Unexpected exception: " + exception);
  }
  finally {
    if (client != null) {
      log.info("Close...");
      client.close();
    }
  }
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:46,代码来源:BasicTest.java

示例4: MqttV3Receiver

import org.eclipse.paho.client.mqttv3.IMqttClient; //导入方法依赖的package包/类
/**
 * @param mqttClient
 * @param reportStream
 */
public MqttV3Receiver(IMqttClient mqttClient, PrintStream reportStream) {

    this.reportStream = reportStream;
    connected = true;

    clientId = mqttClient.getClientId();

}
 
开发者ID:Cirrus-Link,项目名称:Sparkplug,代码行数:13,代码来源:MqttV3Receiver.java


注:本文中的org.eclipse.paho.client.mqttv3.IMqttClient.getClientId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。