Conversation
This adds a new Webhook service for bindings who provide public webhooks, like the cloud binding Signed-off-by: Dan Cunningham <dan@digitaldan.com>
|
Leaving as a draft for review. |
|
I am not convinced yet. If I understand this well, you would need the openhab cloud addon installed for a binding to be able to use this. This then shields you from having to define this dependency. And it becomes up to the user (and documentation) to make sure the dependency is met. It also creates potential issues with startup sequence. |
Did this not create a hard dependency where installing one of the split out sub-bindings still installs the base mqtt binding? In this case, would installing a binding that could optionally use the cloud webhook service then force the cloud binding to get installed even if the user did not intend to use it? I'm not super familiar with how that was broken out. |
In that case, yes. But I believe it is possible to define a karaf feature as optional. It should then be possible to check in the code if the webhook is there, and if not, log a message to install the openhab cloud addon, or not have the specific function available when the cloud addon is not installed. |
|
I’m not sure i understand how that would work to avoid the crazy reflection i have to use right now to invoke functions on the cloud binding to avoid importing cloud binding classes, which would throw a runtime exception if the cloud binding was not installed. Right now the Twilio binding is doing this, and it does work, but it’s ugly and i know there are other bindings who will want to optionally use this. |
|
The reflection is not nice. I was under the impression that @lo92fr was able to make it work without reflection (openhab/openhab-addons#20486 (comment)), but I don't find it in his code. I did see he was using adding the bnd dependency in his pom, but I don't see anything in the feature.xml. |
|
Hello, Yes as said yesterday I've finally was able to prevent reflexion using an optional dependency. There is mainly 2 important point:
Not need to add anythings else in feature.xml Say that, I think it's not ideal, very complex to implement. @mherwege: I understand you concerns about adding specific binding mechanism in core. Laurent |
Shouldn't we then move it to core and avoid the problem? It is probably my knowlege that is lacking here. But does only having an interface in core solve the problem of the openhab cloud addon that maybe is not installed? If calling the methods in the interface, and the addon is not installed, what will happen? Don't we need a mechanism for the binding to query if there is an implementation for the webhook service available before even trying to call it? I would expect you need to build logic in core now to handle that. |
|
In my sense, I would up-vote for moving full openhab cloud to core. In regards to persistance, you comparison are good. But we have many implementation for persistance, only one for cloud ! |
I’m confused, you are importing |
This adds a new webhook service for bindings who provide public webhooks, like the cloud binding
see openhab/openhab-addons#20486 for more info . Right now bindings that want to use the cloud binding's webhook functionality have to go through some ugly hacks to avoid java dependencies between them.