Java Code Examples for io.grpc.stub.MetadataUtils#newAttachHeadersInterceptor()
The following examples show how to use
io.grpc.stub.MetadataUtils#newAttachHeadersInterceptor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthServiceChannel.java From modeldb with Apache License 2.0 | 5 votes |
private void initUACServiceStubChannel() { Metadata requestHeaders = getMetadataHeaders(); LOGGER.trace("Header attaching with stub : {}", requestHeaders); ClientInterceptor clientInterceptor = MetadataUtils.newAttachHeadersInterceptor(requestHeaders); uacServiceBlockingStub = UACServiceGrpc.newBlockingStub(authServiceChannel).withInterceptors(clientInterceptor); LOGGER.trace("Header attached with stub"); }
Example 2
Source File: AuthServiceChannel.java From modeldb with Apache License 2.0 | 5 votes |
private void initRoleServiceStubChannel() { Metadata requestHeaders = getMetadataHeaders(); LOGGER.trace("Header attaching with stub : {}", requestHeaders); ClientInterceptor clientInterceptor = MetadataUtils.newAttachHeadersInterceptor(requestHeaders); roleServiceBlockingStub = RoleServiceGrpc.newBlockingStub(authServiceChannel).withInterceptors(clientInterceptor); LOGGER.trace("Header attached with stub"); }
Example 3
Source File: AuthServiceChannel.java From modeldb with Apache License 2.0 | 5 votes |
private void initRoleServiceFutureStubChannel() { Metadata requestHeaders = getMetadataHeaders(); LOGGER.trace("Header attaching with stub : {}", requestHeaders); ClientInterceptor clientInterceptor = MetadataUtils.newAttachHeadersInterceptor(requestHeaders); roleServiceFutureStub = RoleServiceGrpc.newFutureStub(authServiceChannel).withInterceptors(clientInterceptor); LOGGER.trace("Header attached with stub"); }
Example 4
Source File: AuthServiceChannel.java From modeldb with Apache License 2.0 | 5 votes |
private void initAuthzServiceStubChannel(Metadata requestHeaders) { if (requestHeaders == null) requestHeaders = getMetadataHeaders(); LOGGER.trace("Header attaching with stub : {}", requestHeaders); ClientInterceptor clientInterceptor = MetadataUtils.newAttachHeadersInterceptor(requestHeaders); authzServiceBlockingStub = AuthzServiceGrpc.newBlockingStub(authServiceChannel).withInterceptors(clientInterceptor); LOGGER.trace("Header attached with stub"); }
Example 5
Source File: AuthServiceChannel.java From modeldb with Apache License 2.0 | 5 votes |
private void initTeamServiceStubChannel() { Metadata requestHeaders = getMetadataHeaders(); LOGGER.trace("Header attaching with stub : {}", requestHeaders); ClientInterceptor clientInterceptor = MetadataUtils.newAttachHeadersInterceptor(requestHeaders); teamServiceBlockingStub = TeamServiceGrpc.newBlockingStub(authServiceChannel).withInterceptors(clientInterceptor); LOGGER.trace("Header attached with stub"); }
Example 6
Source File: AuthServiceChannel.java From modeldb with Apache License 2.0 | 5 votes |
private void initOrganizationServiceStubChannel() { Metadata requestHeaders = getMetadataHeaders(); LOGGER.trace("Header attaching with stub : {}", requestHeaders); ClientInterceptor clientInterceptor = MetadataUtils.newAttachHeadersInterceptor(requestHeaders); organizationServiceBlockingStub = OrganizationServiceGrpc.newBlockingStub(authServiceChannel) .withInterceptors(clientInterceptor); LOGGER.trace("Header attached with stub"); }
Example 7
Source File: AgentClientMock.java From pinpoint with Apache License 2.0 | 5 votes |
public AgentClientMock(final String host, final int port, final boolean agentHeader) { NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port); if (agentHeader) { HeaderFactory headerFactory = new AgentHeaderFactory("mockAgentId", "mockApplicationName", System.currentTimeMillis()); final Metadata extraHeaders = headerFactory.newHeader(); final ClientInterceptor headersInterceptor = MetadataUtils.newAttachHeadersInterceptor(extraHeaders); builder.intercept(headersInterceptor); } builder.usePlaintext(); channel = builder.build(); this.agentStub = AgentGrpc.newStub(channel); this.metadataStub = MetadataGrpc.newBlockingStub(channel); }
Example 8
Source File: StatClientMock.java From pinpoint with Apache License 2.0 | 5 votes |
public StatClientMock(final String host, final int port) { NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port); HeaderFactory headerFactory = new AgentHeaderFactory("mockAgentId", "mockApplicationName", System.currentTimeMillis()); final Metadata extraHeaders = headerFactory.newHeader(); final ClientInterceptor headersInterceptor = MetadataUtils.newAttachHeadersInterceptor(extraHeaders); builder.intercept(headersInterceptor); builder.usePlaintext(); channel = builder.build(); this.statStub = StatGrpc.newStub(channel); }
Example 9
Source File: DefaultChannelFactory.java From pinpoint with Apache License 2.0 | 5 votes |
private void addHeader(NettyChannelBuilder channelBuilder) { final Metadata extraHeaders = headerFactory.newHeader(); if (logger.isDebugEnabled()) { logger.debug("addHeader {}", extraHeaders); } final ClientInterceptor headersInterceptor = MetadataUtils.newAttachHeadersInterceptor(extraHeaders); channelBuilder.intercept(headersInterceptor); }
Example 10
Source File: TracingMetadataUtils.java From bazel-buildfarm with Apache License 2.0 | 4 votes |
public static ClientInterceptor attachMetadataInterceptor(RequestMetadata metadata) { Metadata headers = new Metadata(); headers.put(METADATA_KEY, metadata); return MetadataUtils.newAttachHeadersInterceptor(headers); }
Example 11
Source File: TracingMetadataUtils.java From bazel with Apache License 2.0 | 4 votes |
public static ClientInterceptor attachMetadataFromContextInterceptor() { return MetadataUtils.newAttachHeadersInterceptor(headersFromCurrentContext()); }
Example 12
Source File: TracingMetadataUtils.java From bazel with Apache License 2.0 | 4 votes |
public static ClientInterceptor newCacheHeadersInterceptor(RemoteOptions options) { Metadata metadata = newMetadataForHeaders(options.remoteHeaders); metadata.merge(newMetadataForHeaders(options.remoteCacheHeaders)); return MetadataUtils.newAttachHeadersInterceptor(metadata); }
Example 13
Source File: TracingMetadataUtils.java From bazel with Apache License 2.0 | 4 votes |
public static ClientInterceptor newDownloaderHeadersInterceptor(RemoteOptions options) { Metadata metadata = newMetadataForHeaders(options.remoteHeaders); metadata.merge(newMetadataForHeaders(options.remoteDownloaderHeaders)); return MetadataUtils.newAttachHeadersInterceptor(metadata); }
Example 14
Source File: TracingMetadataUtils.java From bazel with Apache License 2.0 | 4 votes |
public static ClientInterceptor newExecHeadersInterceptor(RemoteOptions options) { Metadata metadata = newMetadataForHeaders(options.remoteHeaders); metadata.merge(newMetadataForHeaders(options.remoteExecHeaders)); return MetadataUtils.newAttachHeadersInterceptor(metadata); }