diff --git a/homepage/_packages/cloud2edge/tour.md b/homepage/_packages/cloud2edge/tour.md index 585d9eb6..ac856eea 100644 --- a/homepage/_packages/cloud2edge/tour.md +++ b/homepage/_packages/cloud2edge/tour.md @@ -313,170 +313,160 @@ Then, create the connection: {% clipboard %} curl -i -X POST -u devops:${DITTO_DEVOPS_PWD} -H 'Content-Type: application/json' --data '{ - "targetActorSelection": "/system/sharding/connection", - "headers": { - "aggregate": false - }, - "piggybackCommand": { - "type": "connectivity.commands:createConnection", - "connection": { - "id": "hono-kafka-connection-for-'"${HONO_TENANT/./_}"'", - "name": "[Hono/Kafka] '"${HONO_TENANT}"'", - "connectionType": "kafka", - "connectionStatus": "open", - "uri": "ssl://ditto-c2e:verysecret@'"${RELEASE}"'-kafka:9092", - "ca": "'"${KAFKA_CERT}"'", - "failoverEnabled": true, - "sources": [ - { - "addresses": [ - "hono.telemetry.'"${HONO_TENANT}"'" - ], - "consumerCount": 1, - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "qos": 0, - "enforcement": { - "input": "{{ header:device_id }}", - "filters": [ - "{{ entity:id }}" - ] - }, - "headerMapping": {}, - "payloadMapping": [], - "replyTarget": { - "enabled": true, - "address": "hono.command.'"${HONO_TENANT}"'/{{ thing:id }}", - "headerMapping": { - "device_id": "{{ thing:id }}", - "subject": "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response", - "correlation-id": "{{ header:correlation-id }}" - }, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [], - "filter": "fn:delete()" - }, - "declaredAcks": [] - }, - { - "addresses": [ - "hono.event.'"${HONO_TENANT}"'" - ], - "consumerCount": 1, - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "qos": 1, - "enforcement": { - "input": "{{ header:device_id }}", - "filters": [ - "{{ entity:id }}" - ] - }, - "headerMapping": {}, - "payloadMapping": [], - "replyTarget": { - "enabled": true, - "address": "hono.command.'"${HONO_TENANT}"'/{{ thing:id }}", - "headerMapping": { - "device_id": "{{ thing:id }}", - "subject": "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response", - "correlation-id": "{{ header:correlation-id }}" - }, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [] - }, - "declaredAcks": [] + "name": "[Hono/Kafka] '"${HONO_TENANT}"'", + "connectionType": "kafka", + "connectionStatus": "open", + "uri": "ssl://ditto-c2e:verysecret@'"${RELEASE}"'-kafka:9092", + "ca": "'"${KAFKA_CERT}"'", + "failoverEnabled": true, + "sources": [ + { + "addresses": [ + "hono.telemetry.'"${HONO_TENANT}"'" + ], + "consumerCount": 1, + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "qos": 0, + "enforcement": { + "input": "{{ header:device_id }}", + "filters": [ + "{{ entity:id }}" + ] + }, + "headerMapping": {}, + "payloadMapping": [], + "replyTarget": { + "enabled": true, + "address": "hono.command.'"${HONO_TENANT}"'/{{ thing:id }}", + "headerMapping": { + "device_id": "{{ thing:id }}", + "subject": "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response", + "correlation-id": "{{ header:correlation-id }}" }, - { - "addresses": [ - "hono.command_response.'"${HONO_TENANT}"'" - ], - "consumerCount": 1, - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "qos": 0, - "enforcement": { - "input": "{{ header:device_id }}", - "filters": [ - "{{ entity:id }}" - ] - }, - "headerMapping": { - "correlation-id": "{{ header:correlation-id }}", - "status": "{{ header:status }}" - }, - "payloadMapping": [], - "replyTarget": { - "enabled": false, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [], - "filter": "fn:delete()" - }, - "declaredAcks": [] - } + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [], + "filter": "fn:delete()" + }, + "declaredAcks": [] + }, + { + "addresses": [ + "hono.event.'"${HONO_TENANT}"'" + ], + "consumerCount": 1, + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" ], - "targets": [ - { - "address": "hono.command.'"${HONO_TENANT}"'/{{ thing:id }}", - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "headerMapping": { - "device_id": "{{ thing:id }}", - "subject": "{{ header:subject | fn:default(topic:action-subject) }}", - "correlation-id": "{{ header:correlation-id }}", - "response-required": "{{ header:response-required }}" - }, - "topics": [ - "_/_/things/live/commands", - "_/_/things/live/messages" - ] + "qos": 1, + "enforcement": { + "input": "{{ header:device_id }}", + "filters": [ + "{{ entity:id }}" + ] + }, + "headerMapping": {}, + "payloadMapping": [], + "replyTarget": { + "enabled": true, + "address": "hono.command.'"${HONO_TENANT}"'/{{ thing:id }}", + "headerMapping": { + "device_id": "{{ thing:id }}", + "subject": "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response", + "correlation-id": "{{ header:correlation-id }}" }, - { - "address": "hono.command.'"${HONO_TENANT}"'/{{thing:id}}", - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "topics": [ - "_/_/things/twin/events", - "_/_/things/live/events" - ], - "headerMapping": { - "device_id": "{{ thing:id }}", - "subject": "{{ header:subject | fn:default(topic:action-subject) }}", - "correlation-id": "{{ header:correlation-id }}" - } - } + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [] + }, + "declaredAcks": [] + }, + { + "addresses": [ + "hono.command_response.'"${HONO_TENANT}"'" ], - "specificConfig": { - "saslMechanism": "plain", - "bootstrapServers": "'"${RELEASE}"'-kafka:9092", - "groupId": "'"${HONO_TENANT}"'_{{ connection:id }}" + "consumerCount": 1, + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "qos": 0, + "enforcement": { + "input": "{{ header:device_id }}", + "filters": [ + "{{ entity:id }}" + ] + }, + "headerMapping": { + "correlation-id": "{{ header:correlation-id }}", + "status": "{{ header:status }}" }, - "clientCount": 1, - "failoverEnabled": true, - "validateCertificates": true + "payloadMapping": [], + "replyTarget": { + "enabled": false, + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [], + "filter": "fn:delete()" + }, + "declaredAcks": [] } - } -}' ${DITTO_API_BASE_URL:?}/devops/piggyback/connectivity + ], + "targets": [ + { + "address": "hono.command.'"${HONO_TENANT}"'/{{ thing:id }}", + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "headerMapping": { + "device_id": "{{ thing:id }}", + "subject": "{{ header:subject | fn:default(topic:action-subject) }}", + "correlation-id": "{{ header:correlation-id }}", + "response-required": "{{ header:response-required }}" + }, + "topics": [ + "_/_/things/live/commands", + "_/_/things/live/messages" + ] + }, + { + "address": "hono.command.'"${HONO_TENANT}"'/{{thing:id}}", + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "topics": [ + "_/_/things/twin/events", + "_/_/things/live/events" + ], + "headerMapping": { + "device_id": "{{ thing:id }}", + "subject": "{{ header:subject | fn:default(topic:action-subject) }}", + "correlation-id": "{{ header:correlation-id }}" + } + } + ], + "specificConfig": { + "saslMechanism": "plain", + "bootstrapServers": "'"${RELEASE}"'-kafka:9092", + "groupId": "'"${HONO_TENANT}"'_{{ connection:id }}" + }, + "clientCount": 1, + "failoverEnabled": true, + "validateCertificates": true +}' ${DITTO_API_BASE_URL:?}/api/2/connections {% endclipboard %} {% endvariant %} @@ -485,116 +475,106 @@ curl -i -X POST -u devops:${DITTO_DEVOPS_PWD} -H 'Content-Type: application/json {% clipboard %} curl -i -X POST -u devops:${DITTO_DEVOPS_PWD} -H 'Content-Type: application/json' --data '{ - "targetActorSelection": "/system/sharding/connection", - "headers": { - "aggregate": false - }, - "piggybackCommand": { - "type": "connectivity.commands:createConnection", - "connection": { - "id": "hono-amqp-connection-for-'"${HONO_TENANT/./_}"'", - "name": "[Hono/AMQP1.0] '"${HONO_TENANT}"'", - "connectionType": "amqp-10", - "connectionStatus": "open", - "uri": "amqp://consumer%40HONO:verysecret@'"${RELEASE}"'-dispatch-router-ext:15672", - "failoverEnabled": true, - "sources": [ - { - "addresses": [ - "telemetry/'"${HONO_TENANT}"'", - "event/'"${HONO_TENANT}"'" - ], - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "enforcement": { - "input": "{%raw%}{{ header:device_id }}{%endraw%}", - "filters": [ - "{%raw%}{{ entity:id }}{%endraw%}" - ] - }, - "headerMapping": { - "hono-device-id": "{%raw%}{{ header:device_id }}{%endraw%}", - "content-type": "{%raw%}{{ header:content-type }}{%endraw%}" - }, - "replyTarget": { - "enabled": true, - "address": "{%raw%}{{ header:reply-to }}{%endraw%}", - "headerMapping": { - "to": "command/'"${HONO_TENANT}"'/{%raw%}{{ header:hono-device-id }}{%endraw%}", - "subject": "{%raw%}{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}{%endraw%}-response", - "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}", - "content-type": "{%raw%}{{ header:content-type | fn:default('"'"'application/vnd.eclipse.ditto+json'"'"') }}{%endraw%}" - }, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [], - "filter": "fn:filter(header:qos,'"'"'ne'"'"','"'"'0'"'"')" - } - }, - { - "addresses": [ - "command_response/'"${HONO_TENANT}"'/replies" - ], - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "headerMapping": { - "content-type": "{%raw%}{{ header:content-type }}{%endraw%}", - "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}", - "status": "{%raw%}{{ header:status }}{%endraw%}" - }, - "replyTarget": { - "enabled": false, - "expectedResponseTypes": [ - "response", - "error" - ] - } - } + "name": "[Hono/AMQP1.0] '"${HONO_TENANT}"'", + "connectionType": "amqp-10", + "connectionStatus": "open", + "uri": "amqp://consumer%40HONO:verysecret@'"${RELEASE}"'-dispatch-router-ext:15672", + "failoverEnabled": true, + "sources": [ + { + "addresses": [ + "telemetry/'"${HONO_TENANT}"'", + "event/'"${HONO_TENANT}"'" + ], + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" ], - "targets": [ - { - "address": "command/'"${HONO_TENANT}"'", - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "topics": [ - "_/_/things/live/commands", - "_/_/things/live/messages" - ], - "headerMapping": { - "to": "command/'"${HONO_TENANT}"'/{%raw%}{{ thing:id }}{%endraw%}", - "subject": "{%raw%}{{ header:subject | fn:default(topic:action-subject) }}{%endraw%}", - "content-type": "{%raw%}{{ header:content-type | fn:default('"'"'application/vnd.eclipse.ditto+json'"'"') }}{%endraw%}", - "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}", - "reply-to": "{%raw%}{{ fn:default('"'"'command_response/'"${HONO_TENANT}"'/replies'"'"') | fn:filter(header:response-required,'"'"'ne'"'"','"'"'false'"'"') }}{%endraw%}" - } + "enforcement": { + "input": "{%raw%}{{ header:device_id }}{%endraw%}", + "filters": [ + "{%raw%}{{ entity:id }}{%endraw%}" + ] + }, + "headerMapping": { + "hono-device-id": "{%raw%}{{ header:device_id }}{%endraw%}", + "content-type": "{%raw%}{{ header:content-type }}{%endraw%}" + }, + "replyTarget": { + "enabled": true, + "address": "{%raw%}{{ header:reply-to }}{%endraw%}", + "headerMapping": { + "to": "command/'"${HONO_TENANT}"'/{%raw%}{{ header:hono-device-id }}{%endraw%}", + "subject": "{%raw%}{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}{%endraw%}-response", + "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}", + "content-type": "{%raw%}{{ header:content-type | fn:default('"'"'application/vnd.eclipse.ditto+json'"'"') }}{%endraw%}" }, - { - "address": "command/'"${HONO_TENANT}"'", - "authorizationContext": [ - "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" - ], - "topics": [ - "_/_/things/twin/events", - "_/_/things/live/events" - ], - "headerMapping": { - "to": "command/'"${HONO_TENANT}"'/{%raw%}{{ thing:id }}{%endraw%}", - "subject": "{%raw%}{{ header:subject | fn:default(topic:action-subject) }}{%endraw%}", - "content-type": "{%raw%}{{ header:content-type | fn:default('"'"'application/vnd.eclipse.ditto+json'"'"') }}{%endraw%}", - "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}" - } - } - ] + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [], + "filter": "fn:filter(header:qos,'"'"'ne'"'"','"'"'0'"'"')" + } + }, + { + "addresses": [ + "command_response/'"${HONO_TENANT}"'/replies" + ], + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "headerMapping": { + "content-type": "{%raw%}{{ header:content-type }}{%endraw%}", + "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}", + "status": "{%raw%}{{ header:status }}{%endraw%}" + }, + "replyTarget": { + "enabled": false, + "expectedResponseTypes": [ + "response", + "error" + ] + } } - } -}' ${DITTO_API_BASE_URL:?}/devops/piggyback/connectivity + ], + "targets": [ + { + "address": "command/'"${HONO_TENANT}"'", + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "topics": [ + "_/_/things/live/commands", + "_/_/things/live/messages" + ], + "headerMapping": { + "to": "command/'"${HONO_TENANT}"'/{%raw%}{{ thing:id }}{%endraw%}", + "subject": "{%raw%}{{ header:subject | fn:default(topic:action-subject) }}{%endraw%}", + "content-type": "{%raw%}{{ header:content-type | fn:default('"'"'application/vnd.eclipse.ditto+json'"'"') }}{%endraw%}", + "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}", + "reply-to": "{%raw%}{{ fn:default('"'"'command_response/'"${HONO_TENANT}"'/replies'"'"') | fn:filter(header:response-required,'"'"'ne'"'"','"'"'false'"'"') }}{%endraw%}" + } + }, + { + "address": "command/'"${HONO_TENANT}"'", + "authorizationContext": [ + "pre-authenticated:hono-connection-'"${HONO_TENANT}"'" + ], + "topics": [ + "_/_/things/twin/events", + "_/_/things/live/events" + ], + "headerMapping": { + "to": "command/'"${HONO_TENANT}"'/{%raw%}{{ thing:id }}{%endraw%}", + "subject": "{%raw%}{{ header:subject | fn:default(topic:action-subject) }}{%endraw%}", + "content-type": "{%raw%}{{ header:content-type | fn:default('"'"'application/vnd.eclipse.ditto+json'"'"') }}{%endraw%}", + "correlation-id": "{%raw%}{{ header:correlation-id }}{%endraw%}" + } + } + ] +}' ${DITTO_API_BASE_URL:?}/api/2/connections {% endclipboard %} {% endvariant %} diff --git a/packages/cloud2edge/post-install/hono-amqp-connection.json b/packages/cloud2edge/post-install/hono-amqp-connection.json index 5edb7e62..439d4d85 100644 --- a/packages/cloud2edge/post-install/hono-amqp-connection.json +++ b/packages/cloud2edge/post-install/hono-amqp-connection.json @@ -1,111 +1,101 @@ { - "targetActorSelection": "/system/sharding/connection", - "headers": { - "aggregate": false - }, - "piggybackCommand": { - "type": "connectivity.commands:createConnection", - "connection": { - "id": "hono-amqp-connection-for-{{ .Values.demoDevice.tenant | replace "." "_" }}", - "name": "[Hono/AMQP1.0] {{ .Values.demoDevice.tenant }}", - "connectionType": "amqp-10", - "connectionStatus": "open", - "uri": "amqp://{{ .Values.honoConnection.username }}:{{ .Values.honoConnection.password }}@{{ .Release.Name }}-dispatch-router-ext:15672", - "failoverEnabled": true, - "sources": [ - { - "addresses": [ - "telemetry/{{ .Values.demoDevice.tenant }}", - "event/{{ .Values.demoDevice.tenant }}" - ], - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "enforcement": { - "input": {{ "{{ header:device_id }}" | quote }}, - "filters": [ - {{ "{{ entity:id }}" | quote }} - ] - }, - "headerMapping": { - "hono-device-id": {{ "{{ header:device_id }}" | quote }}, - "content-type": {{ "{{ header:content-type }}" | quote }} - }, - "replyTarget": { - "enabled": true, - "address": {{ "{{ header:reply-to }}" | quote }}, - "headerMapping": { - "to": {{ printf "command/%s/{{ header:hono-device-id }}" .Values.demoDevice.tenant | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, - "content-type": {{ "{{ header:content-type | fn:default('application/vnd.eclipse.ditto+json') }}" | quote }} - }, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [], - "filter": "fn:filter(header:qos,'eq','1')" - } - }, - { - "addresses": [ - "command_response/{{ .Values.demoDevice.tenant }}/replies" - ], - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "headerMapping": { - "content-type": {{ "{{ header:content-type }}" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, - "status": {{ "{{ header:status }}" | quote }} - }, - "replyTarget": { - "enabled": false, - "expectedResponseTypes": [ - "response", - "error" - ] - } - } + "name": "[Hono/AMQP1.0] {{ .Values.demoDevice.tenant }}", + "connectionType": "amqp-10", + "connectionStatus": "open", + "uri": "amqp://{{ .Values.honoConnection.username }}:{{ .Values.honoConnection.password }}@{{ .Release.Name }}-dispatch-router-ext:15672", + "failoverEnabled": true, + "sources": [ + { + "addresses": [ + "telemetry/{{ .Values.demoDevice.tenant }}", + "event/{{ .Values.demoDevice.tenant }}" + ], + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" ], - "targets": [ - { - "address": "command/{{ .Values.demoDevice.tenant }}", - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "topics": [ - "_/_/things/live/commands", - "_/_/things/live/messages" - ], - "headerMapping": { - "to": {{ printf "command/%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, - "content-type": {{ "{{ header:content-type | fn:default('application/vnd.eclipse.ditto+json') }}" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, - "reply-to": {{ printf "{{ fn:default('command_response/%s/replies') | fn:filter(header:response-required,'ne','false') }}" .Values.demoDevice.tenant | quote }} - } + "enforcement": { + "input": {{ "{{ header:device_id }}" | quote }}, + "filters": [ + {{ "{{ entity:id }}" | quote }} + ] + }, + "headerMapping": { + "hono-device-id": {{ "{{ header:device_id }}" | quote }}, + "content-type": {{ "{{ header:content-type }}" | quote }} + }, + "replyTarget": { + "enabled": true, + "address": {{ "{{ header:reply-to }}" | quote }}, + "headerMapping": { + "to": {{ printf "command/%s/{{ header:hono-device-id }}" .Values.demoDevice.tenant | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, + "content-type": {{ "{{ header:content-type | fn:default('application/vnd.eclipse.ditto+json') }}" | quote }} }, - { - "address": "command/{{ .Values.demoDevice.tenant }}", - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "topics": [ - "_/_/things/twin/events", - "_/_/things/live/events" - ], - "headerMapping": { - "to": {{ printf "command/%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, - "content-type": {{ "{{ header:content-type | fn:default('application/vnd.eclipse.ditto+json') }}" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }} - } - } - ] + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [], + "filter": "fn:filter(header:qos,'eq','1')" + } + }, + { + "addresses": [ + "command_response/{{ .Values.demoDevice.tenant }}/replies" + ], + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "headerMapping": { + "content-type": {{ "{{ header:content-type }}" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, + "status": {{ "{{ header:status }}" | quote }} + }, + "replyTarget": { + "enabled": false, + "expectedResponseTypes": [ + "response", + "error" + ] + } + } + ], + "targets": [ + { + "address": "command/{{ .Values.demoDevice.tenant }}", + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "topics": [ + "_/_/things/live/commands", + "_/_/things/live/messages" + ], + "headerMapping": { + "to": {{ printf "command/%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, + "content-type": {{ "{{ header:content-type | fn:default('application/vnd.eclipse.ditto+json') }}" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, + "reply-to": {{ printf "{{ fn:default('command_response/%s/replies') | fn:filter(header:response-required,'ne','false') }}" .Values.demoDevice.tenant | quote }} + } + }, + { + "address": "command/{{ .Values.demoDevice.tenant }}", + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "topics": [ + "_/_/things/twin/events", + "_/_/things/live/events" + ], + "headerMapping": { + "to": {{ printf "command/%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, + "content-type": {{ "{{ header:content-type | fn:default('application/vnd.eclipse.ditto+json') }}" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }} + } } - } + ] } diff --git a/packages/cloud2edge/post-install/hono-kafka-connection.json b/packages/cloud2edge/post-install/hono-kafka-connection.json index 090fd063..b19fced3 100644 --- a/packages/cloud2edge/post-install/hono-kafka-connection.json +++ b/packages/cloud2edge/post-install/hono-kafka-connection.json @@ -1,175 +1,165 @@ { - "targetActorSelection": "/system/sharding/connection", - "headers": { - "aggregate": false - }, - "piggybackCommand": { - "type": "connectivity.commands:createConnection", - "connection": { - "id": "hono-kafka-connection-for-{{ .Values.demoDevice.tenant | replace "." "_" }}", - "name": "[Hono/Kafka] {{ .Values.demoDevice.tenant }}", - "connectionType": "kafka", - "connectionStatus": "open", - {{- if .Values.hono.kafkaMessagingClusterExample.enabled }} - "uri": "ssl://{{ .Values.honoConnection.username }}:{{ .Values.honoConnection.password }}@{{ .Release.Name }}-kafka:9092", - {{- else }} - {{ $kafka := .Values.hono.adapters.kafkaMessagingSpec.commonClientConfig }} - {{ $kafkaServers := splitList "," (index $kafka "bootstrap.servers") }} - "uri": "tcp://{{ .Values.honoConnection.username }}:{{ .Values.honoConnection.password }}@{{ first $kafkaServers }}", - {{- end }} - "sources": [ - { - "addresses": [ - "hono.telemetry.{{ .Values.demoDevice.tenant }}" - ], - "consumerCount": 1, - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "qos": 0, - "enforcement": { - "input": {{ "{{ header:device_id }}" | quote }}, - "filters": [ - {{ "{{ entity:id }}" | quote }} - ] - }, - "headerMapping": {}, - "payloadMapping": [], - "replyTarget": { - "enabled": true, - "address": {{ printf "hono.command.%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, - "headerMapping": { - "device_id": {{ "{{ thing:id }}" | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }} - }, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [], - "filter": "fn:delete()" - }, - "declaredAcks": [] - }, - { - "addresses": [ - "hono.event.{{ .Values.demoDevice.tenant }}" - ], - "consumerCount": 1, - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "qos": 1, - "enforcement": { - "input": {{ "{{ header:device_id }}" | quote }}, - "filters": [ - {{ "{{ entity:id }}" | quote }} - ] - }, - "headerMapping": {}, - "payloadMapping": [], - "replyTarget": { - "enabled": true, - "address": {{ printf "hono.command.%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, - "headerMapping": { - "device_id": {{ "{{ thing:id }}" | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }} - }, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [] - }, - "declaredAcks": [] + "name": "[Hono/Kafka] {{ .Values.demoDevice.tenant }}", + "connectionType": "kafka", + "connectionStatus": "open", + {{- if .Values.hono.kafkaMessagingClusterExample.enabled }} + "uri": "ssl://{{ .Values.honoConnection.username }}:{{ .Values.honoConnection.password }}@{{ .Release.Name }}-kafka:9092", + {{- else }} + {{ $kafka := .Values.hono.adapters.kafkaMessagingSpec.commonClientConfig }} + {{ $kafkaServers := splitList "," (index $kafka "bootstrap.servers") }} + "uri": "tcp://{{ .Values.honoConnection.username }}:{{ .Values.honoConnection.password }}@{{ first $kafkaServers }}", + {{- end }} + "sources": [ + { + "addresses": [ + "hono.telemetry.{{ .Values.demoDevice.tenant }}" + ], + "consumerCount": 1, + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "qos": 0, + "enforcement": { + "input": {{ "{{ header:device_id }}" | quote }}, + "filters": [ + {{ "{{ entity:id }}" | quote }} + ] + }, + "headerMapping": {}, + "payloadMapping": [], + "replyTarget": { + "enabled": true, + "address": {{ printf "hono.command.%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, + "headerMapping": { + "device_id": {{ "{{ thing:id }}" | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }} }, - { - "addresses": [ - "hono.command_response.{{ .Values.demoDevice.tenant }}" - ], - "consumerCount": 1, - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "qos": 0, - "enforcement": { - "input": {{ "{{ header:device_id }}" | quote }}, - "filters": [ - {{ "{{ entity:id }}" | quote }} - ] - }, - "headerMapping": { - "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, - "status": {{ "{{ header:status }}" | quote }} - }, - "payloadMapping": [], - "replyTarget": { - "enabled": false, - "expectedResponseTypes": [ - "response", - "error" - ] - }, - "acknowledgementRequests": { - "includes": [], - "filter": "fn:delete()" - }, - "declaredAcks": [] - } + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [], + "filter": "fn:delete()" + }, + "declaredAcks": [] + }, + { + "addresses": [ + "hono.event.{{ .Values.demoDevice.tenant }}" + ], + "consumerCount": 1, + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" ], - "targets": [ - { - "address": {{ printf "hono.command.%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "headerMapping": { - "device_id": {{ "{{ thing:id }}" | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, - "response-required": {{ "{{ header:response-required }}" | quote }} - }, - "topics": [ - "_/_/things/live/commands", - "_/_/things/live/messages" - ] + "qos": 1, + "enforcement": { + "input": {{ "{{ header:device_id }}" | quote }}, + "filters": [ + {{ "{{ entity:id }}" | quote }} + ] + }, + "headerMapping": {}, + "payloadMapping": [], + "replyTarget": { + "enabled": true, + "address": {{ printf "hono.command.%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, + "headerMapping": { + "device_id": {{ "{{ thing:id }}" | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) | fn:default(topic:criterion) }}-response" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }} }, - { - "address": {{ printf "hono.command.%s/{{thing:id}}" .Values.demoDevice.tenant | quote }}, - "authorizationContext": [ - "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" - ], - "topics": [ - "_/_/things/twin/events", - "_/_/things/live/events" - ], - "headerMapping": { - "device_id": {{ "{{ thing:id }}" | quote }}, - "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, - "correlation-id": {{ "{{ header:correlation-id }}" | quote }} - } - } + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [] + }, + "declaredAcks": [] + }, + { + "addresses": [ + "hono.command_response.{{ .Values.demoDevice.tenant }}" ], - "specificConfig": { - {{- if .Values.hono.kafkaMessagingClusterExample.enabled }} - "saslMechanism": "plain", - "bootstrapServers": "{{ .Release.Name }}-kafka:9092", - {{- else }} - {{ $kafka := .Values.hono.adapters.kafkaMessagingSpec.commonClientConfig }} - "saslMechanism": "{{ (or (index $kafka "sasl.mechanism") "PLAIN") | lower }}", - "bootstrapServers": "{{ index $kafka "bootstrap.servers" }}", - {{- end }} - "groupId": {{ printf "%s_{{ connection:id }}" .Values.demoDevice.tenant | quote }} + "consumerCount": 1, + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "qos": 0, + "enforcement": { + "input": {{ "{{ header:device_id }}" | quote }}, + "filters": [ + {{ "{{ entity:id }}" | quote }} + ] + }, + "headerMapping": { + "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, + "status": {{ "{{ header:status }}" | quote }} + }, + "payloadMapping": [], + "replyTarget": { + "enabled": false, + "expectedResponseTypes": [ + "response", + "error" + ] + }, + "acknowledgementRequests": { + "includes": [], + "filter": "fn:delete()" + }, + "declaredAcks": [] + } + ], + "targets": [ + { + "address": {{ printf "hono.command.%s/{{ thing:id }}" .Values.demoDevice.tenant | quote }}, + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "headerMapping": { + "device_id": {{ "{{ thing:id }}" | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }}, + "response-required": {{ "{{ header:response-required }}" | quote }} }, - "clientCount": 1, - "failoverEnabled": true, - "validateCertificates": true + "topics": [ + "_/_/things/live/commands", + "_/_/things/live/messages" + ] + }, + { + "address": {{ printf "hono.command.%s/{{thing:id}}" .Values.demoDevice.tenant | quote }}, + "authorizationContext": [ + "pre-authenticated:hono-connection-{{ .Values.demoDevice.tenant }}" + ], + "topics": [ + "_/_/things/twin/events", + "_/_/things/live/events" + ], + "headerMapping": { + "device_id": {{ "{{ thing:id }}" | quote }}, + "subject": {{ "{{ header:subject | fn:default(topic:action-subject) }}" | quote }}, + "correlation-id": {{ "{{ header:correlation-id }}" | quote }} + } } - } + ], + "specificConfig": { + {{- if .Values.hono.kafkaMessagingClusterExample.enabled }} + "saslMechanism": "plain", + "bootstrapServers": "{{ .Release.Name }}-kafka:9092", + {{- else }} + {{ $kafka := .Values.hono.adapters.kafkaMessagingSpec.commonClientConfig }} + "saslMechanism": "{{ (or (index $kafka "sasl.mechanism") "PLAIN") | lower }}", + "bootstrapServers": "{{ index $kafka "bootstrap.servers" }}", + {{- end }} + "groupId": {{ printf "%s_{{ connection:id }}" .Values.demoDevice.tenant | quote }} + }, + "clientCount": 1, + "failoverEnabled": true, + "validateCertificates": true } diff --git a/packages/cloud2edge/post-install/post-install.sh b/packages/cloud2edge/post-install/post-install.sh index 19415e46..8bd5bf78 100755 --- a/packages/cloud2edge/post-install/post-install.sh +++ b/packages/cloud2edge/post-install/post-install.sh @@ -14,8 +14,7 @@ DITTO_DEVOPS_USER_PW="devops:$(cat /var/run/c2e/ditto-gw-users/devops-password)" DEVICE_REGISTRY_BASE_URL="http://{{ .Release.Name }}-service-device-registry:8080/v1" -# TODO use HTTP API instead of piggyback commands (https://eclipse.dev/ditto/connectivity-manage-connections.html) -DITTO_CONNECTIVITY_URL="http://{{ .Release.Name }}-ditto-nginx:8080/devops/piggyback/connectivity" +DITTO_CONNECTIVITY_URL="http://{{ .Release.Name }}-ditto-nginx:8080/api/2/connections" DITTO_THINGS_BASE_URL="http://{{ .Release.Name }}-ditto-nginx:8080/api/2/things" DEMO_TENANT="{{ .Values.demoDevice.tenant }}"