首页 > 解决方案 > Hono 和 Enmass 集成引发事件错误

问题描述

我正在尝试使用 enmasse 部署 hono。为此,我已经安装了 enmasse 并创建了地址空间和地址,如下所示:

enmasse_iot.yaml

apiVersion: enmasse.io/v1beta1
kind: AddressSpace
metadata:
  name: iot1
spec:
  type: standard
  plan: standard-medium
  authenticationService:
    name: standard-authservice
---
apiVersion: enmasse.io/v1beta1
kind: Address
metadata:
    name: iot1.command
spec:
    address: command
    type: anycast
    plan: standard-medium-anycast
---
apiVersion: enmasse.io/v1beta1
kind: Address
metadata:
    name: iot1.command-internal
spec:
    address: command_internal
    type: anycast
    plan: standard-medium-anycast
---
apiVersion: enmasse.io/v1beta1
kind: Address
metadata:
    name: iot1.command-response
spec:
    address: command_response
    type: anycast
    plan: standard-medium-anycast
---
apiVersion: enmasse.io/v1beta1
kind: Address
metadata:
    name: iot1.telemetry
spec:
    address: telemetry
    type: anycast
    plan: standard-medium-anycast
---
apiVersion: enmasse.io/v1beta1
kind: Address
metadata:
    name: iot1.event
spec:
    address: event
    type: queue
    plan: standard-small-queue
---
apiVersion: user.enmasse.io/v1beta1
kind: MessagingUser
metadata:
  name: iot1.hono
spec:
  username: hono
  authentication:
    type: password
    password: SE9OTw== # pwd=HONO, Base64 encoded
  authorization:
    - addresses: ["*"]
      operations: ["send","recv","view","manage"]

Hono 安装在 helm 图表上并使用以下值文件:

livenessProbeInitialDelaySeconds: 900
readinessProbeInitialDelaySeconds: 45
useLoadBalancer: false

amqpMessagingNetworkExample:
  enabled: false

commandRouterService:
  extraSecretMounts:
    amqp-network:
      secretName: "mysecret"
      mountPath: "/etc/custom"

adapters:
  http:
    extraSecretMounts:
      amqp-network:
        secretName: mysecret
        mountPath: /etc/custom
  mqtt:
    extraSecretMounts:
      amqp-network:
        secretName: mysecret
        mountPath: /etc/custom

  amqpMessagingNetworkSpec:
    host: messaging-5355a0a.enmasse-infra
    port: 5671
    credentialsPath: /etc/custom/amqp-credentials.properties

  commandAndControlSpec:
    host: messaging-5355a0a.enmasse-infra
    port: 5671
    credentialsPath: /etc/custom/amqp-credentials.properties

deviceRegistryExample:
  enabled: true
  addExampleData: false
  extraSecretMounts:
    amqp-network:
      secretName: mysecret
      mountPath: /etc/custom

mongodb:
  createInstance: false

然后我创建了租户“iot1”并将“dev”添加到 Hono 中的这个租户。之后,我写了一个简单的 AMQP-receiver 并开始实例化如下:

python ./amqp-receiver.py -s amqps://10.100.42.58:5671 -a telemetry/iot1
python ./amqp-receiver.py -s amqps://10.100.42.58:5671 -a event/iot1

另一方面,我的模拟设备将自身与 Hono 的 MQTT 适配器连接,并通过 mqtt 发布遥测和事件。遥测数据由第一个 amqp-receiver 接收,没有任何问题。但是一旦发布事件,Hono 的 MQTT-Adapter 就会引发“无可用信用”错误!

您可以在此处找到 Hono 和 Enmasse 的日志文件。

  1. enmasse 经纪人有问题 - 查看日志文件?
  2. 我的 enmasse 设置错了吗?或者是为 Hono 设置 enmassse 的更好、更清洁的方法?
  3. 应该如何处理事件和命令?

谢谢!

更新

似乎 artemis-broker 无法即时创建事件端点。即从队列“事件”发送和接收工作正常,但与租户的扩展(例如“事件/iot1”)不起作用,这导致hono 的MQTT 适配器中没有可用的信用错误。知道如何在 enmasse yaml 文件中设置 Artemis 的“自动创建-*”选项吗?

标签: amqpeclipse-honoeclipse-iot

解决方案


推荐阅读