-
-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Push: add custom messenger (BC) #17211
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we still need the cmdline execution parts from the former script implementation?
Co-authored-by: Michael Heß <[email protected]>
Bleibt die Frage, ob wir das mergen wollen? |
Regarding my previous comment
I now connected the dots, of the
Yes, I think so. |
Nice reuse of the existing plugin interface :) Does this mean that you can reuse any of the plugins as service endpoint for events ? (mqtt, modbus, http, script, ... all plugins that allow write access). |
switch m.encoding { | ||
case "json": | ||
b, _ := json.Marshal(struct { | ||
Title string `json:"title"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title string `json:"title"` | |
Title string `json:"title,omitempty"` |
I would check if the title is empty or not defined in the config, and omit the title when empty.
This is a common use case for machine-readable payloads like JSON.
You could also allow the msg to be specified in JSON directly, to not impose your custom schema { msg: ..., title: ... } to the user. See #17278 for a proposal.
}) | ||
res = string(b) | ||
case "csv": | ||
res = title + "," + msg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too simplistic, especially when title
and message
can contain commas (to tabs for tsv
). Do we really need csv and tsv ? I can't see any good use case that can not be solved with a stronger typed representation (like json).
res = title + "," + msg | ||
case "tsv": | ||
res = title + "\t" + msg | ||
case "title": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this type does not "fit" into the list: json, csv, tsv are formats (so kind of an encoding), "title" and "message" (the default) are more filters.
Wdyt to restrict encoding to "json" and "string" (or "raw") and have some second options as to whether to include the title or not ? (usually if you only use a single service endpoint and you don't need the title, you just don't define it in events:
...
Fix #17148 by adding custom messenger. Custom messenger uses encoding to combine
title
andmsg
into a single value to send to plugin. Valid encodings arejson
,csv
andtsv
. If encoding is omitted only the message is transferred.BC: removes
script
messenger. This is replaced by: