-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add amqp queue driver #402
Conversation
I'm very excited about this one @josephmancuso. Great work |
we will need to find a way to pass in variables to the job. I am thinking we do it like Laravel and just instantiate the object instead of passing the class: from app.jobs import SomeJob
...
def show(self, Queue):
# do your normal logic
Queue.push(SomeJob(variable1, variable2)) But if this is going into the minor we also need to support this for This would mean that the constructor will no longer support being resolved but we can still make the handle method resolved if anything. I want to make sure this goes into the next minor so @aisola and I can use it in some current projects we have. |
@MasoniteFramework/reviewers Without any objections, I'm going to merge this in tonight. |
The latest commit also adds the ability to do 2 things:
from app.jobs import SayHello
def show(self, Queue):
Queue.push(SayHello) This will resolve the constructor
from app.jobs import SayHello
def show(self, Queue):
Queue.push(SayHello('variable1', 'variable2')) Instantiating the class will NOT resolve the constructor. So it is currently either have the constructor resolved or pass in data from controller (which can include any dependencies you need anyway so not THAT big of a deal.) |
This PR adds support for real message brokers for queues. Currently we just have an async driver which sends jobs into a seperate thread which works pretty well actually but this PR introduces support for any
amqp
standardized message broker like Rabbitmq.Once this PR gets merged the way to use it will be:
amqp
and add the required credentials:which starts the server.
and you should see them in the worker terminal window:
That's it!