emqx icon indicating copy to clipboard operation
emqx copied to clipboard

Configuring emqx_rule_engine plugin events events cannot take effect

Open mijjjj opened this issue 3 years ago • 3 comments

What happened?

My meqx version is 4.3.5, started via docker. Configured in environment variables EMQX_RULE-ENGINE__EVENTS__CLIENT_CONNECTED: on, qos1 EMQX_RULE-ENGINE__EVENTS__CLIENT_DISCONNECTED: on, qos1 Or configure it in the configuration file /opt/emqx/etc/plugins/emqx_rule_engine.conf

Subscribe via Subscription Super Admin $events/client_connected Didn't receive the notification of the client going offline

What did you expect to happen?

Receive notification of client going offline

How can we reproduce it (as minimally and precisely as possible)?

No response

Anything else we need to know?

No response

EMQX version

4.4

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Log files

mijjjj avatar Jul 21 '22 05:07 mijjjj

Hi. EMQX_RULE-ENGINE__EVENTS__CLIENT_CONNECTED is not a valid environment variable name (mind the -). Please try EMQX_RULE_ENGINE__EVENTS__CLIENT_CONNECTED.

zmstone avatar Jul 21 '22 12:07 zmstone

Using the EMQX_RULE_ENGINE__EVENTS__CLIENT_CONNECTED environment variable injection still fails to take effect, and subscribing to $events/client_connected still fails to receive the client online message

mijjjj avatar Jul 22 '22 06:07 mijjjj

image This is my docker configuration diagram

mijjjj avatar Jul 22 '22 06:07 mijjjj

Hi @mijjjj $event topics are 'virtual' topics, ~~they do not exist in the routing table, so no client can subscribe to it.~~ the events are not published as MQTT messages, but only processed in rule-engine.

zmstone avatar Aug 11 '22 13:08 zmstone

Hi @mijjjj I was not able to reproduce the issue you reported. Tried to run with this command: docker run --network host --rm -it -e EMQX_RULE_ENGINE__EVENTS__CLIENT_CONNECTED='on, qos1' emqx/emqx:4.4.8 bash and created a debug rule like this: SELECT * FROM "$events/client_connected" with a inspect action (for debug)

Then connect a client, I was able to see printouts in the console.

zmstone avatar Sep 01 '22 21:09 zmstone