Skip to content

Commit 9644e82

Browse files
initial resources
1 parent 02ee074 commit 9644e82

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed

my-custom-module/data-policy.json.vm

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"id": "${instanceId}-my-custom-policy",
3+
"matching": {
4+
"topicFilter": "${topicFilter}"
5+
},
6+
"validation": {
7+
"validators": [
8+
{
9+
"type": "schema",
10+
"arguments": {
11+
"strategy": "ALL_OF",
12+
"schemas": [
13+
{
14+
"schemaId": "${instanceId}-simple-json",
15+
"version": "latest"
16+
}
17+
]
18+
}
19+
}
20+
]
21+
},
22+
"onSuccess": {
23+
"pipeline": [
24+
{
25+
"id": "success-log-operation",
26+
"functionId": "System.log",
27+
"arguments": {
28+
"level": "INFO",
29+
"message": "The client ${clientId} sent a valid JSON message."
30+
}
31+
}
32+
]
33+
},
34+
"onFailure": {
35+
"pipeline": [
36+
{
37+
"id": "fail-log-operation",
38+
"functionId": "System.log",
39+
"arguments": {
40+
"level": "ERROR",
41+
"message": "The client ${clientId} sent an invalid message: ${validationResult}"
42+
}
43+
},
44+
{
45+
"id": "fail-drop-operation",
46+
"functionId": "Mqtt.drop",
47+
"arguments": {
48+
"reasonString": "The message you sent was a not in JSON format."
49+
}
50+
}
51+
]
52+
}
53+
}

my-custom-module/index.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "My first custom module",
3+
"description": "My first custom module description",
4+
"maintainers": [
5+
{
6+
"name": "my required name",
7+
"email": "my-optional-email-address@provider.com",
8+
"url": "https://my-optional.website.com"
9+
}
10+
],
11+
"version": "1.0.0",
12+
"requiredSystemVersions": [
13+
"hivemq-enterprise/4.34.0"
14+
],
15+
"resources": {
16+
"files": [
17+
{
18+
"type": "application/vnd+hivemq.data-policy+json",
19+
"path": "data-policy.json.vm",
20+
"name": "Data Policy to handle non-JSON messages"
21+
},
22+
{
23+
"type": "application/vnd+hivemq.schema+json",
24+
"path": "schema.json",
25+
"name": "Simple JSON schema"
26+
}
27+
]
28+
}
29+
}

my-custom-module/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "${instanceId}-simple-json",
3+
"type": "JSON",
4+
"schemaDefinition": "e30="
5+
}

my-custom-module/variables.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"topicFilter": {
5+
"type": "string",
6+
"default": "#",
7+
"title": "Topic filter matching",
8+
"description": "The PUBLISH message topic filter to which the instance applies"
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)