Closed kh-hani closed 4 years ago
Yes you can do that, but it depends on how you will be handle the incoming queue message. Question: do you use laravel for both sides microservices right?
Yes, we use Laravel on both sides! The BFF microservice is Laravel. The backend microservices are Lumen, and in Lumen, we noticed that we could catch the subscriber as part of the queue system.
So the following part is how we handle the incoming queue messages in Lumen:
// TenancyServiceProvider.php
// Resolve any tenant related meta data on job and allow resolving of tenant.
$queue->before(function (JobProcessing $jobProcessing) {
config()->set('database.connections.mysql.database', $jobProcessing->job->payload()['tenant_id']);
});
@kh-hani Aaah yes I see, with cloud-pubsub, that will be very easy, you just need to serialise your message before sending it through publisher, once the message is available through the queue, the subscriber can handle the message and deserialize it :)
thank you, I'll try to do that.
I'm building a Microservice-based Multi-tenancy SaaS application.
We have noticed that publishing to PubSub is not touching the queue system. Therefore something like the following is not valid with this package:
We want to inject the
tenant_id
as part of the payload like the following:Is it possible to achieve that using this package, or should I do something else?