A few questions:

   - What language is this for? Only PHP protos?
   - Is there a reason for needing the two distinct proto files? Can you 
   reuse one of them for the other service?
   - Are you setting the `php_class_prefix` option in your `.proto` file? 
   If not, I think this might be a way to implement your intended behavior.


On Tuesday, July 26, 2022 at 4:14:59 AM UTC-7 sergey.s...@gmail.com wrote:

> 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?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/6f136f19-3a41-4fb6-8cf8-00f855d2402dn%40googlegroups.com.

Reply via email to