在mqtt上发布gerrit流
germqtt的Python项目详细描述
germqtt,顾名思义,是发布gerrit事件流的工具 进入MQTT。它将发布gerrit事件流中的所有捕获事件 并将它们发布到mqtt,按项目和事件类型划分主题。为了 示例添加到项目名foo的注释将作为事件发布 关于主题:添加基本主题/foo/评论
默认情况下,germqtt设置为守护进程,但是如果需要运行它 以交互方式,您可以使用–foreground选项来执行此操作。
配置
要使germqtt正常工作,需要一些信息。 这些设置在配置文件中指定。
格瑞特
您需要提供连接到的凭据和连接信息 gerrit获取事件流。germqtt使用gerritlib库建立 通过ssh连接gerrit并监听事件流。所有这些 选项位于[gerrit]部分。gerrit需要的3个选项是:
- username - The username to login with
- hostname - The hostname for your gerrit server
- key - The path to your ssh key to use for connecting to gerrit
还有一个可选的配置选项port,用于指定 连接Gerrit的端口。默认设置为29418,即 格瑞特违约。如果gerrit服务器使用非默认端口,则需要设置 这个选项。
mqtt
与gerrit一样,与mqtt交谈有几个必需的选项,其中 是GeMQTT中的另一个通信轴。配置mqtt的选项 通信进入[mqtt]部分。两个必需的选项是:
- hostname - The hostname for the MQTT broker
- topic - The base topic name to use for the gerrit events
还有一些用于与mqtt通信的可选设置 可设置:
- port - The port to communicate to the MQTT broker on. By default this
- is set to 1883, the default MQTT port. This only needs to be set if your broker uses a non-default port.
- keepalive - Used to set the keepalive time for connections to the MQTT
- broker. By default this is set to 60 seconds.
- username - Used to set the auth username to connect to the MQTT broker
- with.
- password - Used to set the auth password to connect to the MQTT broker
- with. A username must be set for this option to be used.
其他设置
默认情况下,germqtt将对其pid文件使用/var/run/germqtt.pid,如果 您想使用不同的文件来存储pid,可以使用pid file 配置文件的[默认值]部分中的选项。