rule-actions 命令

rule-actions list [-t [<type>]] [-k [<hook>]]List all actions
rule-actions show <ActionId>Show a rule action

Tip

动作可以由 emqx 内置(称为系统内置动作),或者由 emqx 插件编写,但不能通过 CLI/API 添加或删除。

rule-actions show

查询动作:

  1. ## 查询名为 'built_in:inspect_action' 动作
  2. $ ./bin/emqx_ctl rule-actions show 'built_in:inspect_action'
  3. action(name='built_in:inspect_action', app='emqx_rule_engine', for='$any', type='built_in', params=#{}, description='Inspect the details of action params for debug purpose')

rule-actions list

列出符合条件的动作:

  1. ## 列出当前所有的动作
  2. $ ./bin/emqx_ctl rule-actions list
  3. action(name='built_in:republish_action', app='emqx_rule_engine', for='message.publish', type='built_in', params=#{target_topic => #{description => <<"Repubilsh the message to which topic">>,format => topic,required => true,title => <<"To Which Topic">>,type => string}}, description='Republish a MQTT message to a another topic')
  4. action(name='web_hook:event_action', app='emqx_web_hook', for='$events', type='web_hook', params=#{'$resource' => #{description => <<"Bind a resource to this action">>,required => true,title => <<"Resource ID">>,type => string},template => #{description => <<"The payload template to be filled with variables before sending messages">>,required => false,schema => #{},title => <<"Payload Template">>,type => object}}, description='Forward Events to Web Server')
  5. action(name='web_hook:publish_action', app='emqx_web_hook', for='message.publish', type='web_hook', params=#{'$resource' => #{description => <<"Bind a resource to this action">>,required => true,title => <<"Resource ID">>,type => string}}, description='Forward Messages to Web Server')
  6. action(name='built_in:inspect_action', app='emqx_rule_engine', for='$any', type='built_in', params=#{}, description='Inspect the details of action params for debug purpose')
  7. ## 列出所有资源类型为 web_hook 的动作
  8. $ ./bin/emqx_ctl rule-actions list -t web_hook
  9. action(name='web_hook:event_action', app='emqx_web_hook', for='$events', type='web_hook', params=#{'$resource' => #{description => <<"Bind a resource to this action">>,required => true,title => <<"Resource ID">>,type => string},template => #{description => <<"The payload template to be filled with variables before sending messages">>,required => false,schema => #{},title => <<"Payload Template">>,type => object}}, description='Forward Events to Web Server')
  10. action(name='web_hook:publish_action', app='emqx_web_hook', for='message.publish', type='web_hook', params=#{'$resource' => #{description => <<"Bind a resource to this action">>,required => true,title => <<"Resource ID">>,type => string}}, description='Forward Messages to Web Server')
  11. ## 列出所有 Hook 类型匹配 'client.connected' 的动作
  12. $ ./bin/emqx_ctl rule-actions list -k 'client.connected'
  13. action(name='built_in:inspect_action', app='emqx_rule_engine', for='$any', type='built_in', params=#{}, description='Inspect the details of action params for debug purpose')