-
大小: 26.19MB文件类型: .rar金币: 1下载: 0 次发布日期: 2023-06-22
- 语言: 其他
- 标签: MQTT apache-apoll
资源简介
Apache Apollo是一个代理服务器,Apollo允许客户端通过开放的MQTT协议连接。
代码片段和文件信息
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 example;
import org.apache.qpid.amqp_1_0.jms.impl.*;
import javax.jms.*;
class Listener {
public static void main(String []args) throws JMSException {
String user = env(“APOLLO_USER“ “admin“);
String password = env(“APOLLO_PASSWORD“ “password“);
String host = env(“APOLLO_HOST“ “localhost“);
int port = Integer.parseInt(env(“APOLLO_PORT“ “61613“));
String destination = arg(args 0 “topic://event“);
ConnectionFactoryImpl factory = new ConnectionFactoryImpl(host port user password);
Destination dest = null;
if( destination.startsWith(“topic://“) ) {
dest = new TopicImpl(destination);
} else {
dest = new QueueImpl(destination);
}
Connection connection = factory.createConnection(user password);
connection.start();
Session session = connection.createSession(false Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = session.createConsumer(dest);
long start = System.currentTimeMillis();
long count = 1;
System.out.println(“Waiting for messages...“);
while(true) {
Message msg = consumer.receive();
if( msg instanceof TextMessage ) {
String body = ((TextMessage) msg).getText();
if( “SHUTDOWN“.equals(body)) {
long diff = System.currentTimeMillis() - start;
System.out.println(String.format(“Received %d in %.2f seconds“ count (1.0*diff/1000.0)));
connection.close();
System.exit(1);
} else {
try {
if( count != msg.getIntProperty(“id“) ) {
System.out.println(“mismatch: “+count+“!=“+msg.getIntProperty(“id“));
}
} catch (NumberFormatException ignore) {
}
if( count == 1 ) {
start = System.currentTimeMillis();
} else if( count % 1000 == 0 ) {
System.o
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5476 2015-01-29 10:55 apache-apollo-1.7.1\bin\apollo
文件 2891 2015-01-29 10:55 apache-apollo-1.7.1\bin\apollo.cmd
文件 42511 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\index.html
文件 49576 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\index.rss
文件 3963 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1-0-beta1.html
文件 6551 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1-0-beta2.html
文件 5820 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1-0-beta3.html
文件 5550 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1-0-beta4.html
文件 5710 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1-0-beta5.html
文件 5133 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1-0-beta6.html
文件 6274 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.0.html
文件 3206 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.1.html
文件 3663 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.2.html
文件 3382 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.3.html
文件 2996 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.4.html
文件 4064 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.5.html
文件 3525 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.6.html
文件 4848 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\blog\releases\release-1.7.html
文件 4448 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\building.html
文件 5678 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\contributing.html
文件 3392 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\developers.html
文件 4816 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\faq.html
文件 5006 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\index.html
文件 3749 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\release-guide.html
文件 4138 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\site.html
文件 6417 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\source.html
文件 2781 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\community\support.html
文件 20977 2015-01-29 10:54 apache-apollo-1.7.1\docs\site\documentation\amqp-manual.html
文件 34898 2015-01-29 10:47 apache-apollo-1.7.1\docs\site\documentation\api\apollo-broker\index\index-a.html
文件 19389 2015-01-29 10:47 apache-apollo-1.7.1\docs\site\documentation\api\apollo-broker\index\index-b.html
............此处省略1182个文件信息
相关资源
- MQTT单片机编程小工具.exe
- STM32F4x7+freertos+lwip+ssl+MQTT-(MDK5)稳定
- MQTT-3.1.1-CN学习MQTT协议的完整中文资料
- ESP32 MQTT的DEMO
- MQTT单片机编程小工具(技小新).zi
- MQTT客户端
- Mqtt发布与订阅功能
- STM32CubeMX通过ESP8266 AT指令MQTT上阿里云
- emqttd-windows7-v2.3.0.zip
-
MQTT单片机编程小工具(阿里云li
n - MQTT服务端
- MQTT 服务器和客户端工具及使用说明
- MQTT.fx安装包 windows64位系统
- apollo-mqtt服务器搭建
- 基于MQTT协议的物联网通信系统的研究
- MQTT固件使用指导.zip
- 移柯L206 ALIYUN_MQTT开发流程说明
- Quectel_EC2x&EG9x;&EM05;_MQTT_Application_Note
- vert.x结合springboot开发mqtt服务,真实可
- TMS MQTT_v1.1.0.2.rar
- ESP8266和MQTT协议接收平台下发命令版
- 移动onenet 基于arduino IDE 的mqtt连接
- delphi mqtt
- EC20开发资料,含源码
- mqtt发布和订阅
- mqtt订阅和发送及mqttws31.js
- ios手机端集成mqtt接受服务器推送消息
- 501222zw_mqtt_fc.zip
- thingsboard之MQTT接入TB说明0531.docx
- qt activemq mqtt 动态库
评论
共有 条评论