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

How to use multiple services and events providers ? #191

Open
labordep opened this issue Oct 1, 2024 · 0 comments
Open

How to use multiple services and events providers ? #191

labordep opened this issue Oct 1, 2024 · 0 comments
Labels
question Further information is requested

Comments

@labordep
Copy link
Member

labordep commented Oct 1, 2024

Discussed in https://github.com/OpenSmock/Molecule/discussions/162

Originally posted by labordep June 9, 2023
The problem appears when we are using multiple Components with the same contract definition (static), during the execution we are subscribe to multiple components and we are interesseted of uses same services contract from mutiple Component with different name.

For events, actually we are receiving all events but without the way to know the name of the emitter. A solution is to add the name of the emitter directly in the arguments of the events but this is not compatible with Component principles (do not modify used contract). For services, a solution is to create a services method manually which invoke the services from the targeted Component name, but this is uggly.

May be some solutions :

  • Services : Return a proxy when a service is called self myUsedComponentServices componentNamed: #componentB myServices
  • Events : get the name of the provider from the stack, as an example using thisContext to get the name of the emitter
@labordep labordep added enhancement New feature or request question Further information is requested and removed enhancement New feature or request labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant