• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MemoryPersistence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.paho.client.mqttv3.internal.MemoryPersistence的典型用法代码示例。如果您正苦于以下问题:Java MemoryPersistence类的具体用法?Java MemoryPersistence怎么用?Java MemoryPersistence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MemoryPersistence类属于org.eclipse.paho.client.mqttv3.internal包,在下文中一共展示了MemoryPersistence类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence; //导入依赖的package包/类
public void start() {
    log.info("Starting Wilcard subscriber");
    try {
        final String clientId = MqttClient.generateClientId();
        final MqttClient mqttClient = new MqttClient(BROKER_URL, clientId, new MemoryPersistence());

        mqttClient.setCallback(new SubscribeCallback(mqttClient));

        log.info("Connecting to {} with clientID {}", BROKER_URL, clientId);
        mqttClient.connect();

        //We subscribe to wildcard
        log.info("Subscribing to {}", TOPIC_SUBSCRIPTION);
        mqttClient.subscribe(TOPIC_SUBSCRIPTION, QUALITY_OF_SERVICE_LEVEL);

    } catch (MqttException e) {
        log.error("An unexpected error occured. Exiting", e);
        System.exit(1);
    }
}
 
开发者ID:dc-square,项目名称:paho-wildcard-subscriber,代码行数:21,代码来源:WildcardSubscriber.java


示例2: MQTTSubscriber

import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence; //导入依赖的package包/类
public MQTTSubscriber(PubSubMiddleware pubsub) {
	try {
		client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
				new MemoryPersistence());

		client.setCallback(new PushCallback(pubsub));
		client.connect();

	} catch (MqttException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chauhansaurabhb,项目名称:EndUserInteractioion_RequestResponse_Command,代码行数:13,代码来源:MQTTSubscriber.java


示例3: MQTTPublisher

import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence; //导入依赖的package包/类
public MQTTPublisher() {
	try {
		client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
				new MemoryPersistence());
		client.connect();

	} catch (MqttException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chauhansaurabhb,项目名称:EndUserInteractioion_RequestResponse_Command,代码行数:11,代码来源:MQTTPublisher.java


示例4: onCreate

import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence; //导入依赖的package包/类
/**
 * Initalizes the DeviceId and most instance variables
 * Including the Connection Handler, Datastore, Alarm Manager
 * and ConnectivityManager.
 */
@Override
public void onCreate() {
        super.onCreate();

        mDeviceId = String.format(DEVICE_ID_FORMAT,
                                  Secure.getString(getContentResolver(), Secure.ANDROID_ID));

        HandlerThread thread = new HandlerThread(MQTT_THREAD_NAME);
        thread.start();

        mConnHandler = new Handler(thread.getLooper());

        try {
                mDataStore = new MqttDefaultFilePersistence(getCacheDir().getAbsolutePath());
        } catch(MqttPersistenceException e) {
                e.printStackTrace();
                mDataStore = null;
                mMemStore = new MemoryPersistence();
        }

        mOpts = new MqttConnectOptions();
        mOpts.setCleanSession(MQTT_CLEAN_SESSION);
        // Do not set keep alive interval on mOpts we keep track of it with alarm's

        mAlarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
        mConnectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
}
 
开发者ID:JesseFarebro,项目名称:android-mqtt,代码行数:33,代码来源:MqttService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractMessageConverter类代码示例发布时间:2022-05-22
下一篇:
Java SchematronOutputType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap