在我设置的API Gateway
应用中请求traceId。然后通过HTTP
将其传递给我的无状态服务。但是服务应该RPC
调用另一项服务(使用IServiceRemotingListener
)。如何将traceId传递给其他服务?
到目前为止(根据this):
public interface ICommunicationService : IService
{
Task<string> FooAsync();
}
public class Stateless1 : StatelessService, ICommunicationService
{
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[] { new ServiceInstanceListener(c => this.CreateServiceRemotingListener(c)) };
}
public Task<string> FooAsync()
{
return Task.FromResult("TraceId: " + TraceId);
}
}
并尝试使用它:
ICommunicationService service = ServiceProxy.Create<ICommunicationService>(new Uri("fabric:/App/Stateless1"));
string message = await service.FooAsync();
如何将TraceId传递给其他服务b RPC?