betim
Detecting batch queries/mutations on the server-side
Hello all,
Looking to leverage batching as a means to streamline some of our cross-service requests, both query and mutation. We have a graph of interconnected tRPC services, some of which form trees of calls where service A calls service B, and service B then calls service C. Looking to get some guidance on how to identify on the receiving side whether a particular method invocation is a part of a batch request so that I could then batch requests to a downstream service, eg. I receive 10 queries in a batch to service A, which I would then like to batch in a single call to service B, and so on.
Specifically:
1. Is there a mechanism I could introspect to tell that the current method invocation (query or mutation) is part of a batch request?
2. Is there a mechanism I could use to get access to the input and context of the other requests of the same type in the batch?
Thanks!
14 replies