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

Invocable lifetime #74

Closed
soend opened this issue Jan 1, 2019 · 2 comments
Closed

Invocable lifetime #74

soend opened this issue Jan 1, 2019 · 2 comments

Comments

@soend
Copy link

soend commented Jan 1, 2019

I would like to call a method in my invocable from a hosted service but it's only possible if i register invocable in transient lifetime.
In docs invocable is registered:
services.AddScoped<SendNightlyReportsEmailJob>();

Will something brake in Coravel internally if i register my invocable as transient? For example:
services.AddTransient<SendNightlyReportsEmailJob>();

@jamesmh
Copy link
Owner

jamesmh commented Jan 3, 2019

You can scope your invocables as transient or scoped and everything should be fine.

If you really wanted (for some reason) you could even create a singleton invocable! That would still work assuming you are injecting dependencies that are appropriate for singletons.

@jamesmh jamesmh closed this as completed Jan 3, 2019
@soend
Copy link
Author

soend commented Jan 3, 2019

Thats great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants