Skip to content
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

Feature: Command service #142

Open
NeoCortex97 opened this issue Nov 20, 2020 · 1 comment
Open

Feature: Command service #142

NeoCortex97 opened this issue Nov 20, 2020 · 1 comment
Labels
enhancement New feature or request Hacktoberfest service Requires changes to a service

Comments

@NeoCortex97
Copy link
Contributor

Description

This Platform could need a service that can execute commands on receiving an event.
I think there should be a service that can take A structure defining the parameters and a pattern for one or more commands. These can be executed from within any bundle by sending an event with the missing information.
This should be best implemented by having one service for all commands

@NeoCortex97 NeoCortex97 added the enhancement New feature or request label Nov 20, 2020
@hlxid hlxid added the service Requires changes to a service label Nov 20, 2020
@NeoCortex97
Copy link
Contributor Author

I want to share some of my thoughts behind that idea:

I think this service should either allow configuring an event per command or the command that should be executed could be passed with a general execute event.
I think multiple events would be more elegant because it seems to express the intention better. I want to explain this with a little example:

Maybe you want to use espeak as a tts system. Le's assume for a moment that there would be no nodejs library to use espeak even if there is one.
You could configure a speak-event so if a bundle wants to perform tts it would simply send "speak" and an object that contains the text. So if you name your commands in a sensible way, chances are that bundles you install will work out of the box if they communicate via events.

I know that there are no common best practices or guidelines on which types of services should use what communication mechanism, but I think events would be a sensible solution for tasks that do not really need to return data to the caller.

I also want to list a second example, where using a service instead of executing the command directly could come in handy:

Imagine that you wrote a beautiful Python script or a c++ program that does someone on its own and does not need external parameters to do its thing. If your script or program is not stable and you change things, maybe the path of your script changes or you suddenly need a parameter.
In that case, you would search all code for your command and change it in every place. At least in my head, that sounds like a lot of work that could be avoided if you would have a central place to store your commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest service Requires changes to a service
Projects
None yet
Development

No branches or pull requests

2 participants