Hello,
Set up:
2 separate services having their own protobuf files.
Service1 :
service.proto
queries.proto
Service2:
service.proto (different from service1)
queries.proto (different from service1)
filters.proto
And a mediator service (gateway) which needs to query both services for data through grpc calls.
Service1 and Service2 have different package names in proto files and different namespaces configured in options (php plugin)
Problem:
Once I try to compile them and include in project everything will be fine till i will try to
create objects from same named proto files (eventho namespaces will be different)
example:
<?php
declare(strict_types = 1);
require __DIR__ . '/vendor/autoload.php';
$q1 = new \Service1\SearchQuery();
$q2 = new \Service2\FilteredQuery(); <- problem will occur here
I've traced it to the way pool is set up in generated files:
\Google\Protobuf\Internal\DescriptorPool::getGeneratedPool()
its one for all namespaces.
Obvious solution is to rename proto files to be named separately in both services, but that kind of breaks service independence
Question:
Is there a proper way of handling this situation?
Maybe I am misusing protobuf concept?