ibm-watson-iot / iot-java

Client libraries and samples for connecting to IBM Watson IoT using Java
https://internetofthings.ibmcloud.com
Eclipse Public License 1.0
54 stars 82 forks source link

additional "resilient" event publishing capabilities? #55

Closed dlaboss closed 7 years ago

dlaboss commented 8 years ago

Apache Edgent provides a connector to Watson IoT using the iot-java client under the covers.

An Edgent user asked about support for a case where the IoT device application needs to run and accumulate publish events in the face of intermittent connectivity to the IoT platform, with the events ultimately delivered/published when the connection is reestablished. i.e., the device application essentially desires to be unaware of / isolated from actual connectivity to the IoT platform.

It’s possible that a IoT platform connection can’t be made when the device app starts or that the connection is unintentionally intermittent (e.g., due to loss of wifi signal), or intentionally intermittent such as if the device/app desires a policy of only periodically connecting to the IoT platform to publish events that occurred while disconnected.

I don’t believe this scenario is addressed by the current QOS-1 or QOS-2 event publishing controls - i.e., I believe a successful connect() must be performed prior to calling publishEvent(), and also that publishEvent() will fail, without queueing the event, if a connection isn’t present at the time it’s called?

Comments / thoughts on this overall (common?) scenario and iot-java’s current or anticipated capabilities?

Thanks in advance!

miketran78727 commented 8 years ago

@dlaboss The Watson iot-java library just picked up new Paho Java client 1.1 which provides auto reconnect and offline publishing capabilities. I am thinking to add 2 new options "Auto-Reconnect" and "Offline-Publishing." Note that this does not mean that the device can publish before initial connect. The device must have successfully connected once.

dlaboss commented 8 years ago

Thx! Any sort of ETA for when a new version of iot-java might be available with it? Seems a shame (surprising?) that offline-publishing wouldn't cover the initial app startup case of queuing/persisting if not, or can't, connect, doesn't it?
Or perhaps the "must have successfully connected once" really meant "once ever by this clientId on the device" and not "once by this clientId during this instance of the app/JMV"?

miketran78727 commented 8 years ago

I will check with Sathis @sathipal on the plan of releasing a new version of iot-java. We working on some new features and bug fixes. I think we can include Auto Reconnect and Offline Publishing in the next release.

"must have successfully connected once" means "once by this clientId during this instance of the app" as it was decided during design discussion of the feature in Paho Java Client. There is already an enhancement request for offline publishing before initial connect, see https://github.com/eclipse/paho.mqtt.java/issues/233

sathipal commented 7 years ago

@miketran78727 Can we close this issue as its released under 0.2.2?

miketran78727 commented 7 years ago

@sathipal , yes we can close this issue now.