New plugin API: Inter plugin communications #885
Replies: 4 comments 9 replies
-
I would suggest that the second approach (simple message passing) is more open-ended, and probably simpler to both implement and utilise. I'm interpreting it as a system where each plugin can "broadcast" its data and any other plugins can choose to listen to broadcasts - if it gets a message which it wants, then it will do something with it. However, I'd say that passing around JSON would be better than simple strings. Even better: |
Beta Was this translation helpful? Give feedback.
-
Let me take a step back (and forgive me if this is covered elsewhere) but what use cases are driving this? I am not implying we should not have inter-plug-in comms. More implying that they may help direct us to toward an answer. Brainstorming types of plug-ins that would need to send or receive messages:
There are probably other cases. However, none of them favour either a structured RPC or simple message passing system. Non-functional/quality attributes are also minor. For example, EDMC is not time-critical or memory constrained. Therefore, I would lean toward the simpler implementation: simple message passing. However, there are other questions beyond structured RPC versus simple message passing. For example:
|
Beta Was this translation helpful? Give feedback.
-
My reasoning for this is that we already have plugins making calls out to other plugins in the EDMC core, (you can ask for inara and edsm updates to ping you -- see https://github.com/EDCD/EDMarketConnector/blob/main/PLUGINS.md#plugin-specific-events )
All of these are options, yeah. But a simple system would cover most if not all of their use cases. My main reason for asking this question is to get a feel what kind of system devs would like, rather than getting too deep into implementation (which I will do below)
I missed this in my initial read-through and answering stuff, this was written last. Yeah, this is about my feel. Simpler is better for EDMC, if we do need a more complex system, we can probably implement it later.
This may or may not actually matter, it can be completely worked around by only allowing message passing once startup and load is complete everywhere.
Either system will require the recieving plugin to have some sort of callback for recieving messages. As for whether or not we want to send back to the caller "yes they got that" that would be dependant on whether its RPC based or message passing based. Message passing would be best effort, RPC would allow for returns.
I'd put this down as "Do as your own risk" style. There are reasons for blocking it and reasons for having it. Which leads to...
No. Loops are bugs that need to be fixed, not worked around. Either by plugin developers if they build looping systems or by us if we introduce loops. The python stack limit will do nicely to deal with that. As for queues, I havent considered that. My plan when I asked for this was for it to be syncronous.
Im wondering if this is going far too deeply into a complex implementation of what can be a reasonably simple system.
I'd really rather not manage dependencies between plugins, but as there are multiple stages to loading (which I guess I should modify now -- Either a final load_complete event sent to all plugins or similar. Yes that does have order issues, but in theory will at least be deterministic), they should work each other out so long as there arent any hard dependencies at load (which for EDMC I don't see what you'd need that you couldn't error out on after a full load) Specifically for plugin3_prestart, Part of all of the "New plugin API" is that plugins will be class based. Right now what Im messing with instantiates that class and then calls a load method, but as I mentioned above, this could be modified to call an additional method on all plugins once everyone is
I don't know, that's why I'm asking :D I don't want to end up with a message passing system where people may have wanted some more RPC like behavior, and thus end up building their own request-response message pairs.
Yes, that's what I'm defining message passing as. If you want to broadcast something, use an event. Any plugin that wants to listen to an event can hook onto it. Yes I'm making a distinction in what is essentially two kinds of event systems, but that helps me with a mental model of how I'm thinking this will all work
I covered this above. I'm not sure. This is why I want to get a feel from devs as to what they'd like.
If I'm correct in my assumption that you're referring to plugins A and B both defining ID Z, simple, As is A.Z and Bs B.Z. Unless you see an issue with that that I dont see?
Is this referring to plugins and their own events? I was considering letting plugins work that out themselves, as they're working together anyway. I feel I need to clarify that I want both an event system (as in broadcast) and a message / RPC system (as in 1 to 1). The former is already in EDMC, just in a very brittle format, and thus will need to be supported going forward--Though I intend expanding it to support arbitrary events from both sides of the system. The latter seems like a nice thing to have--Whether or not it'll actually be used or otherwise I'm not sure :D but thats why I'm asking here |
Beta Was this translation helpful? Give feedback.
-
Btw, the initial impetus for an inter-plugin API was this discussion: https://discord.com/channels/164411426939600896/726419472772235306/755815747841818654 |
Beta Was this translation helpful? Give feedback.
-
Looking for what all the plugin devs want when it comes to an inter-plugin communication API, to roll into the new plugin system Im slowly building at https://github.com/A-UNDERSCORE-D/EDMarketConnector/tree/feature/new-plugin-system
Currently Im planning to already have a much more open event system, where plugins can fire arbitrary events and hook on arbitrary events, rather than only allowing ones that are programmatically built into EDMC, but I digress.
EDIT for clarification: The event system mentioned above is the "same" one that will carry new journal updates and so on, its unrelated to the IPC discussion below, where the above events are broadcast messages, and IPC is 1 -> 1 communication.
For IPC itself, I'm of two minds.
EDIT 2: Seems people are leaning towards simpler message passing
Beta Was this translation helpful? Give feedback.
All reactions