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

[MicroService]: Allow providing a Server as a class #4410

Closed
shlomiassaf opened this issue Mar 24, 2020 · 2 comments
Closed

[MicroService]: Allow providing a Server as a class #4410

shlomiassaf opened this issue Mar 24, 2020 · 2 comments
Labels
needs triage This issue has not been looked into type: enhancement 🐺

Comments

@shlomiassaf
Copy link

Feature Request

Is your feature request related to a problem? Please describe.

A microservice Server does not have access to system services organically, a service, if required must be assigned manually.

In other words, there is no dependency injection support for the Server implementation and one must set value to the server instance directly.

Describe the solution you'd like

Allow setting a class to the strategy property and when a class is set instantiate it
using the container.

Since the NestMicroservice class is also an application context this shouldn't be an issue.

What is the motivation / use case for changing the behavior?

Some implementation might require more logic and work, for example, a strict bus like the Azure Service Bus will require pre-defined queues/topics so a verification might be required.
Or, an option to create them on the fly.

@shlomiassaf shlomiassaf added needs triage This issue has not been looked into type: enhancement 🐺 labels Mar 24, 2020
@kamilmysliwiec
Copy link
Member

A microservice Server does not have access to system services organically, a service, if required must be assigned manually. In other words, there is no dependency injection support for the Server implementation and one must set value to the server instance directly.

This is how it was designed and honestly, I don't see any reason why we should consider rewriting this (all the existing strategies live and should live outside of the container).

Some implementation might require more logic and work, for example, a strict bus like the Azure Service Bus will require pre-defined queues/topics so a verification might be required.

You should expose them as a public API of your strategy then (options object). Unfortunately, passing precalculated/resolved values (from the container) isn't possible yet, but we're tracking this here #2343

@lock
Copy link

lock bot commented Jun 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into type: enhancement 🐺
Projects
None yet
Development

No branches or pull requests

2 participants