Link Search Menu Expand Document Edit GitHub

Schema


The schema command of the HiveMQ command line offers a set of commands to work with schemas using a HiveMQ Data Hub API endpoint.

NOTE: The HiveMQ Data Hub is a new product in the HiveMQ platform and commands using it may be subject to breaking changes in the future.

mqtt hivemq schema

Commands

CommandExplanation
createSee Create Schema
getSee Get Schema
listSee List Schemas
deleteSee Delete Schema

Options

Help Options

OptionLong VersionExplanation
-h--helpDisplay help message for command.
-V--versionDisplay version information of the cli.

Create Schema


Create a new schema and upload it to a HiveMQ node. The schema definition may be provided either directly from the command line or from a file.

mqtt hivemq schema create

Simple Example

mqtt hivemq schema create --id my-schema-id --type PROTOBUF --file my-schema.desc --message-type Message 

Options

OptionLong VersionExplanationDefaultRequired
-i--idThe id of the schema to be created. X
 --typeThe type of the schema. (Currently supported schema types [JSON, PROTOBUF]) X
 --definitionThe definition of the schema. This should be a JSON Schema string for ‘–type JSON’ or a compiled Protobuf descriptor for ‘–type PROTOBUF’. Either --definition or --file, but not both
 --fileA path to a file containing the definition of the schema. Either --definition or --file, but not both
 --message-typeOnly used with ‘–type PROTOBUF’. The Protobuf message type to use for the schema. When type is PROTOBUF
 --allow-unknownOnly used with ‘–type PROTOBUF’. If provided, Protobuf messages may contain fields not specified in the schema.false 
 --print-versionPrint the assigned schema version after creation.false 

API Connection Options

OptionLong VersionExplanationDefault
-u--urlThe URL of the HiveMQ REST API endpoint.http://localhost:8888
-r--rateThe rate limit of the rest calls to the HiveMQ API endpoint in requests per second.1500

Logging Options

OptionLong VersionExplanationDefault
-l Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/config.properties).false

Help Options

OptionLong VersionExplanation
-h--helpDisplay help message for command.
-V--versionDisplay version information of the cli.

Get Schema


Retrieve a single existing schema.

mqtt hivemq schema get

Simple Example

$ mqtt hivemq schema get --id my-schema-id 
{
  "arguments": {},
  "createdAt": "2023-05-25T21:10:42.779Z",
  "id": "my-schema-id",
  "schemaDefinition": "eyAidHlwZSI6ICJvYmplY3QiIH0K",
  "type": "JSON"
}

Options

OptionLong VersionExplanationRequired
-i--idThe id of the schema to fetch.X
-f--fieldSelect which JSON fields appear in the response. Can be specified multiple times. 

API Connection Options

OptionLong VersionExplanationDefault
-u--urlThe URL of the HiveMQ REST API endpoint.http://localhost:8888
-r--rateThe rate limit of the rest calls to the HiveMQ API endpoint in requests per second.1500

Logging Options

OptionLong VersionExplanationDefault
-l Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/config.properties).false

Help Options

OptionLong VersionExplanation
-h--helpDisplay help message for command.
-V--versionDisplay version information of the cli.

List Schemas


List every schema that exists on a HiveMQ node. This list may optionally be filtered by schema id and schema type.

mqtt hivemq schema list

Simple Example

$ mqtt hivemq schema list --id schema-1
{
  "items": [
    {
      "id": "schema-1",
      "version": 1,
      "createdAt": "2023-06-12T00:38:34.911Z",
      "type": "JSON",
      "schemaDefinition": "ewogICJkZXNjcmlwdGlvbiI6ICJUaGlzIGlzIGFub3RoZXIgZ2VuZXJpYyBKU09OIHNjaGVtYSwgc2luY2UgaXQgcmVxdWlyZXMganVzdCBhIEpTT04sIG5vdGhpbmcgZnVydGhlciBzcGVjaWZpZWQiLAogICJ0eXBlIjogIm9iamVjdCIKfQo",
      "arguments": {}
    },
    {
      "id": "schema-1",
      "version": 2,
      "createdAt": "2023-06-12T09:57:55.862Z",
      "type": "JSON",
      "schemaDefinition": "ewogICJkZXNjcmlwdGlvbiI6ICJUaGlzIGlzIGEgdGhlIG1vc3QgZ2VuZXJpYyBKU09OIHNjaGVtYSwgc2luY2UgaXQgcmVxdWlyZXMganVzdCBhIEpTT04sIG5vdGhpbmcgZnVydGhlciBzcGVjaWZpZWQiLAogICJ0eXBlIjogIm9iamVjdCIKfQ==",
      "arguments": {}
    }
  ]
}

Options

OptionLong VersionExplanationRequired
-i--idFilter by schemas with a matching schema id. Can be specified multiple times. 
-t--typeFilter by schemas of a matching schema type. Can be specified multiple times 
-f--fieldSelect which JSON fields appear in the response. Can be specified multiple times. 
 --limitLimit the maximum number of schemas returned. 

API Connection Options

OptionLong VersionExplanationDefault
-u--urlThe URL of the HiveMQ REST API endpoint.http://localhost:8888
-r--rateThe rate limit of the rest calls to the HiveMQ API endpoint in requests per second.1500

Logging Options

OptionLong VersionExplanationDefault
-l Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/config.properties).false

Help Options

OptionLong VersionExplanation
-h--helpDisplay help message for command.
-V--versionDisplay version information of the cli.

Delete Schema


Delete a single existing schema.

mqtt hivemq schema delete

Simple Example

mqtt hivemq schema delete --id my-schema-id 

Options

OptionLong VersionExplanationRequired
-i--idThe id of the schema to be deleted.X

API Connection Options

OptionLong VersionExplanationDefault
-u--urlThe URL of the HiveMQ REST API endpoint.http://localhost:8888
-r--rateThe rate limit of the rest calls to the HiveMQ API endpoint in requests per second.1500

Logging Options

OptionLong VersionExplanationDefault
-l Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/config.properties).false

Help Options

OptionLong VersionExplanation
-h--helpDisplay help message for command.
-V--versionDisplay version information of the cli.