本文整理了Java中org.fusesource.mqtt.client.MQTT.setTracer()
方法的一些代码示例,展示了MQTT.setTracer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MQTT.setTracer()
方法的具体详情如下:
包路径:org.fusesource.mqtt.client.MQTT
类名称:MQTT
方法名:setTracer
暂无
代码示例来源:origin: apache/storm
/**
* Initializes {@code connection}.
* @throws Exception if an exception during connecting to connector occurs
*/
public static void startPublisher() throws Exception {
MQTT client = new MQTT();
client.setTracer(new MqttLogger());
client.setHost("tcp://localhost:1883");
client.setClientId("MqttBrokerPublisher");
connection = client.blockingConnection();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
LOG.info("Shutting down MQTT client...");
connection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
});
connection.connect();
}
代码示例来源:origin: apache/storm
client.setTracer(new MqttLogger());
代码示例来源:origin: eu.limetri.ygg/ygg-client
private void connect() throws Exception {
mqttClient.setHost(baseUrl.getHost(), port);
mqttClient.setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
log.debug("receive:{}", frame);
}
@Override
public void onSend(MQTTFrame frame) {
log.debug("send:{}", frame);
}
});
mqttClient.setUserName(username);
mqttClient.setPassword(password);
connection = mqttClient.blockingConnection();
connection.connect();
}
代码示例来源:origin: apache/activemq-artemis
private MQTT createMQTTSslConnection(String clientId, boolean clean) throws Exception {
MQTT mqtt = new MQTT();
mqtt.setConnectAttemptsMax(1);
mqtt.setReconnectAttemptsMax(0);
mqtt.setTracer(createTracer());
mqtt.setHost("ssl://localhost:" + port);
if (clientId != null) {
mqtt.setClientId(clientId);
}
mqtt.setCleanSession(clean);
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(new KeyManager[0], new TrustManager[]{new DefaultTrustManager()}, new SecureRandom());
mqtt.setSslContext(ctx);
return mqtt;
}
代码示例来源:origin: apache/activemq-artemis
mqtts[i].setKeepAlive((short) 15);
mqtts[i].setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
代码示例来源:origin: apache/activemq-artemis
private MQTT createMQTTTcpConnection(String clientId, boolean clean) throws Exception {
MQTT mqtt = new MQTT();
mqtt.setConnectAttemptsMax(1);
mqtt.setReconnectAttemptsMax(0);
mqtt.setTracer(createTracer());
mqtt.setVersion("3.1.1");
if (clientId != null) {
mqtt.setClientId(clientId);
}
mqtt.setCleanSession(clean);
mqtt.setHost("localhost", port);
return mqtt;
}
代码示例来源:origin: apache/activemq-artemis
mqtt.setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
代码示例来源:origin: apache/activemq-artemis
mqtt.setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
代码示例来源:origin: apache/activemq-artemis
mqtt.setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
代码示例来源:origin: apache/activemq-artemis
mqtt.setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
代码示例来源:origin: apache/activemq-artemis
mqtt.setTracer(new Tracer() {
@Override
public void onReceive(MQTTFrame frame) {
内容来源于网络,如有侵权,请联系作者删除!