Java 类org.eclipse.paho.client.mqttv3.internal.MemoryPersistence 实例源码

项目:paho-wildcard-subscriber    文件:WildcardSubscriber.java   
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);
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTSubscriber.java   
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();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTSubscriber.java   
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();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTSubscriber.java   
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();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTSubscriber.java   
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();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTSubscriber.java   
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();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTSubscriber.java   
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();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:IoTSuite    文件:MQTTSubscriber.java   
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();
    }
}
项目:IoTSuite    文件:MQTTPublisher.java   
public MQTTPublisher() {
    try {
        client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
                new MemoryPersistence());
        client.connect();

    } catch (MqttException e) {
        e.printStackTrace();
    }
}
项目:android-mqtt    文件:MqttService.java   
/**
 * 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);
}