1

I'm using demo webhooks (python) from VerneMQ plugins

But the demo only have auth_on_register ,auth_on_publish and auth_on_subscribe

My message have pass all the chain but the sub can't see the message from the pub

hook: auth_on_register
data:  {'peer_addr': '192.168.122.1', 'peer_port': 52363, 'mountpoint': '', 'client_id': 'quan-client', 'username': 'quan1', 'password': '123', 'clean_session': True}
127.0.0.1:58109 - - [25/May/2020 02:40:49] "HTTP/1.1 POST /" - 200 OK
hook: auth_on_register
data:  {'peer_addr': '192.168.122.1', 'peer_port': 46091, 'mountpoint': '', 'client_id': 'quan-client', 'username': 'quan1', 'password': '123', 'cle
an_session': True}
127.0.0.1:60003 - - [25/May/2020 02:40:49] "HTTP/1.1 POST /" - 200 OK
hook: auth_on_publish
data:  {'username': 'quan1', 'mountpoint': '', 'client_id': 'quan-client', 'qos': 0, 'topic': 'a', 'payload': 'dGVzdA==', 'retain': False}
127.0.0.1:58109 - - [25/May/2020 02:40:49] "HTTP/1.1 POST /" - 200 OK
hook: auth_on_subscribe
data:  {'username': 'quan1', 'mountpoint': '', 'client_id': 'quan-client', 'topics': [{'topic': 'a', 'qos': 0}]}
127.0.0.1:58109 - - [25/May/2020 02:40:49] "HTTP/1.1 POST /" - 200 OK

I guess that I have miss the on_deliver chain but I can't find any example in python of it, the github only in erlang https://github.com/vernemq/vernemq_dev/blob/master/src/on_deliver_hook.erl

Question: are there any method, function to deliver the message to sub in python language?

2240
  • 1,547
  • 2
  • 12
  • 30
Lê Minh Quân
  • 177
  • 1
  • 9

1 Answers1

0

Please have a look at the doc: https://docs.vernemq.com/plugindevelopment/webhookplugins You need to do 2 things: register the hook, that is tell VerneMQ that you want to give an endpoint for the on_deliver hook. You can do this registration in the vernemq.conf file, or dynamically from the commandline.

Note that with WebHooks you implement the WebHook backend, not the plugin in Erlang. You'll have to add the functionality in your Python backend, respecting the given JSON interface.

André F.
  • 356
  • 1
  • 4