Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
haind6 committed May 31, 2024
1 parent 882daee commit 21aee5b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project is a simple example of how to use gRPC with Spring Cloud Gateway, w
### Generate protobuf file

```shell
.\gradlew build
gradle build
```
```shell
.\gradlew.bat build
Expand All @@ -19,7 +19,7 @@ This project is a simple example of how to use gRPC with Spring Cloud Gateway, w
### Run project

```shell
.\gradlew bootRun --parallel
gradle bootRun --parallel
```
```shell
.\gradlew.bat bootRun --parallel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

@Configuration
public class GRPCLocalConfiguration {
@Bean
public GrpcSslConfigurer grpcSslConfigurer(HttpClientProperties properties) {
return new GrpcSslConfigurer(properties.getSsl()) {
@Override
public ManagedChannel configureSsl(NettyChannelBuilder builder) {
return builder.usePlaintext().defaultLoadBalancingPolicy("round_robin").build();
}
};
}

@Bean
public GrpcSslConfigurer grpcSslConfigurer(HttpClientProperties properties) {
return new GrpcSslConfigurer(properties.getSsl()) {
@Override
public ManagedChannel configureSsl(NettyChannelBuilder builder) {
return builder.usePlaintext().defaultLoadBalancingPolicy("round_robin").build();
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@SpringBootApplication
public class GatewayServiceApplication {

public static void main(String[] args) {
SpringApplication.run(GatewayServiceApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(GatewayServiceApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
@GRpcService
@Slf4j
public class GreetingService extends GreetingServiceGrpc.GreetingServiceImplBase {
@Override
public void hello(Greeting.HelloRequest request, StreamObserver<Greeting.HelloResponse> responseObserver) {
try {
Greeting.HelloResponse response = Greeting.HelloResponse.newBuilder()
.setGreeting("Hello, " + request.getName())
.build();

responseObserver.onNext(response);
responseObserver.onCompleted();
log.info("Create user completed");
} catch (Exception ex) {
responseObserver.onError(ex);
}
@Override
public void hello(Greeting.HelloRequest request,
StreamObserver<Greeting.HelloResponse> responseObserver) {
try {
Greeting.HelloResponse response = Greeting.HelloResponse.newBuilder()
.setGreeting("Hello, " + request.getName()).build();

responseObserver.onNext(response);
responseObserver.onCompleted();
log.info("On completed");
} catch (Exception ex) {
responseObserver.onError(ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@SpringBootApplication
public class GreetingServiceApplication {

public static void main(String[] args) {
SpringApplication.run(GreetingServiceApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(GreetingServiceApplication.class, args);
}

}

0 comments on commit 21aee5b

Please sign in to comment.