Skip to content

Custom obs and command formats for the CS API - #45

Closed
tipatterson-dev wants to merge 7 commits into
masterfrom
feat/consys-custom-formats-v2
Closed

tipatterson-dev wants to merge 7 commits into
masterfrom
feat/consys-custom-formats-v2

Conversation

@tipatterson-dev

Copy link
Copy Markdown

Lets addon modules plug custom encodings (e.g. application/swe+proto, application/swe+flatbuffers) into the Connected Systems API for observations, commands and their schemas. Needed by the federation/MQTT work in osh-addons (fed-service-pr-cleanup).

Changes

  • CustomObsFormat: datastream schema and obs bindings, isAutoSelectable so a format can be listed without being auto-picked for browsers.
  • New CustomCommandFormat: command stream schema and command bindings. One class can implement both; ConSysApiService registers each configured class for whichever it implements.
  • Custom formats are routed on datastream/control stream schema GET and POST, and on obs/command GET, POST and streaming.
  • Command streams list compatible custom formats in formats, like datastreams.
  • RequestContext(servlet, URI, OutputStream) for one-shot GETs from other transports.
  • Streaming handlers take the format only from f=; transports (MQTT) now pass their :data/<format> token as f= instead of pre-setting the context format.

Same work as opensensorhub#354, with all of the review comments there addressed.

Testing

  • sensorhub-service-consys tests pass; full core suite passes except a flaky threaded SensorML test (TestSMLProcessing.testReadAndExecNestedChainsWithThreads) that passes when rerun.
  • Live, with the osh-addons branch: swe+proto obs and command schemas over HTTP and MQTT; two-node federation with the counter sim driver, commands sent to the commander over HTTP and MQTT ran on the remote.

… schemas

Extend the CustomObsFormat SPI with command-side hooks (getCommandBinding,
getCommandSchemaBinding) and an isAutoSelectable flag, and thread the
configured customFormats map through the obs, command, command-status,
datastream-schema and command-stream-schema handlers so a registered format
(e.g. application/swe+proto) can serve its own data and schema views.
… POST

Dispatch datastream and control-stream creation to a registered custom
format's binding when the embedded schema names it. DataStreamBindingJson
gains a custom-format branch ahead of the application/swe+ prefix match;
CommandStreamBindingJson buffers the schema object and dispatches on
commandFormat, staying backward-compatible (a missing commandFormat still
uses the default JSON binding); CommandStreamHandler threads the
customFormats map through to the binding.
@tipatterson-dev

Copy link
Copy Markdown
Author

Superseded by #46 (branch renamed to feat/consys-custom-formats).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant