public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.example.grpc.GoodbyeRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.example.grpc.GoodbyeRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
public Builder mergeFrom(com.example.grpc.GoodbyeRequest other) { if (other == com.example.grpc.GoodbyeRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getReason().isEmpty()) { reason_ = other.reason_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public static void main(String[] args) { String jwt = createJwt(Constant.JWT_SECRET, "authClient", "rayt"); //String jwt = createJwt("123124123", "authClient", "rayt"); System.out.println("Created a JWT: " + jwt); JwtCallCredential callCredential = new JwtCallCredential(jwt); ManagedChannel greetingChannel = ManagedChannelBuilder.forAddress("localhost", 8080) .usePlaintext(true) .intercept(new TraceIdClientInterceptor()) .build(); ManagedChannel goodbyeChannel = ManagedChannelBuilder.forAddress("localhost", 9090) .usePlaintext(true) .intercept(new TraceIdClientInterceptor()) .build(); Context.current().withValue(Constant.TRACE_ID_CTX_KEY, "1").run(() -> { GreetingServiceGrpc.GreetingServiceBlockingStub greetingStub = GreetingServiceGrpc.newBlockingStub(greetingChannel).withCallCredentials(callCredential); HelloResponse helloResponse = greetingStub.greeting(HelloRequest.newBuilder().setName("Ray").build()); System.out.println(helloResponse); }); Context.current().withValue(Constant.TRACE_ID_CTX_KEY, "2").run(() -> { GoodbyeServiceGrpc.GoodbyeServiceBlockingStub goodbyeStub = GoodbyeServiceGrpc.newBlockingStub(goodbyeChannel).withCallCredentials(callCredential); GoodbyeResponse goodbyeResponse = goodbyeStub.goodbye(GoodbyeRequest.newBuilder().setName("Jason").build()); System.out.println(goodbyeResponse); }); }
public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.example.grpc.GoodbyeRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.example.grpc.GoodbyeRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
private Builder() { maybeForceBuilderInitialization(); }
public static Builder newBuilder(com.example.grpc.GoodbyeRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
/** * <code>string name = 1;</code> */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; }
public static Builder newBuilder(com.example.grpc.GoodbyeRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
/** * <code>string reason = 2;</code> */ public Builder setReasonBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); reason_ = value; onChanged(); return this; } public final Builder setUnknownFields(
private Builder() { maybeForceBuilderInitialization(); }
/** * <code>string reason = 2;</code> */ public Builder setReasonBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); reason_ = value; onChanged(); return this; } public final Builder setUnknownFields(
public Builder mergeFrom(com.example.grpc.GoodbyeRequest other) { if (other == com.example.grpc.GoodbyeRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getReason().isEmpty()) { reason_ = other.reason_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public static void main(String[] args) { ManagedChannel goodbyeChannel = ManagedChannelBuilder.forAddress("localhost", 9090) .usePlaintext(true) .intercept(new BraveGrpcClientInterceptor(Constant.brave("client-example"))) .intercept(MonitoringClientInterceptor.create(Configuration.allMetrics())) .build(); for (int i = 0; i < 100; i++) { GoodbyeServiceGrpc.GoodbyeServiceBlockingStub stub = GoodbyeServiceGrpc.newBlockingStub(goodbyeChannel); GoodbyeResponse goodbye = stub.goodbye(GoodbyeRequest.newBuilder().setName("Ray").build()); System.out.println(goodbye); } goodbyeChannel.shutdownNow(); } }
/** * <code>string name = 1;</code> */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /**
/** * <code>string reason = 2;</code> */ public Builder setReason( java.lang.String value) { if (value == null) { throw new NullPointerException(); } reason_ = value; onChanged(); return this; } /**
/** * <code>string reason = 2;</code> */ public Builder clearReason() { reason_ = getDefaultInstance().getReason(); onChanged(); return this; } /**
/** * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.example.grpc.GoodbyeRequest) { return mergeFrom((com.example.grpc.GoodbyeRequest)other); } else { super.mergeFrom(other); return this; } }
/** * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.example.grpc.GoodbyeRequest) { return mergeFrom((com.example.grpc.GoodbyeRequest)other); } else { super.mergeFrom(other); return this; } }