Uploaded image for project: 'Edgent'
  1. Edgent
  2. EDGENT-394

Wish I could use IotDevice.events in a "fluent" style

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Connectors
    • None

    Description

      Publishing of device events requires using IotDevice.events() which takes a TStream of events to be published. That requires me to introduce a TStream variable even when I don't otherwise need one.

      An example of the kind of thing I'd like to be able to write:

      IotDevice device = new IotpDevice(...);
      AtomicInteger sensorState = new AtomicInteger();
      ...
      topology.poll(readSensor, 1, SECONDS)
          .filter(val -> val != sensorState.getAndSet(val)) // only publish changes
          .map(val -> toJsonObject(val))
          .sink(device.eventConsumer("myEventId", QoS.AT_LEAST_ONCE));
      

      device.eventConsumer() returns a new Consumer<JsonObject>

      Attachments

        Activity

          People

            Unassigned Unassigned
            dlaboss Dale LaBossiere
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: