Thank you. I have used Context.attach and detach . will try out this option as well.
On Thursday, 19 November 2020 at 01:06:15 UTC+5:30 [email protected] wrote: > You might use > > CompletableFuture.supplyAsync > <https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#supplyAsync-java.util.function.Supplier-java.util.concurrent.Executor-> > (Supplier > <https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html> > <U> supplier, Executor > <https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html> > executor) > > and pass the second argument as context.fixedContextExecutor() or > Context.currentContextExecutor(). > > On Monday, November 16, 2020 at 11:54:35 PM UTC-8 [email protected] > wrote: > >> Hi, >> >> I have Service A which has to call Service B and C asynchronously. So i >> used Java 8 CompletableFuture supplyAsync method. >> >> *Problem: * >> Service A gets JWT token from the caller , using Server interceptor it >> validates the token and if the token is valid it is set in the gRPC Context >> to propagate token to further client calls. >> >> When i put the CompletableFuture , it creates a new thread for Service B >> and C calls so the gRPC context where the token set is lost. Service B and >> C calls are failing with missing token. >> >> >> Background: Earlier Service A calls only B. So the ServerInterceptor >> which sets the token was available in clientInterceptor for calling B. >> >> As a new enhancement added Service C call. >> >> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/29dab1e2-b8af-445d-b683-1abf554df319n%40googlegroups.com.
