hashicorp / go-plugin

Golang plugin system over RPC.
Mozilla Public License 2.0
5.25k stars 450 forks source link

Inversion of Control - possible? #211

Closed tigerinus closed 2 years ago

tigerinus commented 2 years ago

First of all, this is a great project.

As I read, the host loads the plugins typically.

It is possible to do it the other way, e.g. each plugin registers itself with the host when the process containing that plugin runs?

Thanks.

fairclothjm commented 2 years ago

@tigerinus Hi, this is not currently supported by go-plugin. The host process is responsible for launching the plugin binaries. Please see https://github.com/hashicorp/go-plugin/blob/master/docs/internals.md#go-plugin-internals

tigerinus commented 2 years ago

I think what I can do is provide a list of plugins as a configuration file or something like that. When host runs, it loads the plugins based on the configuration file, much like the original Spring Boot XML for the same purpose in the good old time.