有两个python gRPC服务@Override
public void onMapReady(GoogleMap googleMap) {
mMap= googleMap;
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
}
和A
。
服务B
需要在服务A
上调用rpc才能向客户端发送响应。
服务B
还有一个拦截器,可将信息添加到它使用的gRPC上下文中。
问题:
如何将gRPC上下文传递给服务A
,以便可以访问服务B
中的gRPC上下文信息?
答案 0 :(得分:1)
由于您正在更改python对象本身,因此当前无法在gRPC调用中传递它。尽管您可以使用上下文的send_initial_metadata
方法设置元数据并在服务B
中编写新的拦截器来解析存储在invocation_metadata
中的信息,然后在您的第二项服务。