Skip to content

Commit e719956

Browse files
committed
Code review response
- Config uses GrpcHeaders.SERVICE_METHOD for method def - Removed amqp dependency update - Removed changes to barrier pom.xml - spring grpc now uses bom
1 parent e9871c9 commit e719956

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

basic/barrier/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
</dependency>
7474
<dependency>
7575
<groupId>org.springframework.boot</groupId>
76-
<artifactId>spring-boot-starter-rabbitmq</artifactId>
77-
<version>4.1.0-SNAPSHOT</version>
76+
<artifactId>spring-boot-starter-amqp</artifactId>
7877
<scope>compile</scope>
7978
</dependency>
8079
<dependency>

basic/grpc-client/src/main/java/org/springframework/integration/samples/grpc/client/GrpcClientConfiguration.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.integration.samples.grpc.client;
1818

19+
import java.util.Collections;
20+
1921
import io.grpc.ManagedChannel;
2022
import org.apache.commons.logging.Log;
2123
import org.apache.commons.logging.LogFactory;
@@ -30,6 +32,7 @@
3032
import org.springframework.integration.channel.FluxMessageChannel;
3133
import org.springframework.integration.core.MessagingTemplate;
3234
import org.springframework.integration.dsl.IntegrationFlow;
35+
import org.springframework.integration.grpc.GrpcHeaders;
3336
import org.springframework.integration.grpc.dsl.Grpc;
3437
import org.springframework.integration.support.MessageBuilder;
3538
import org.springframework.messaging.Message;
@@ -47,7 +50,7 @@ public class GrpcClientConfiguration {
4750

4851
@Bean
4952
ManagedChannel managedChannel(GrpcChannelFactory factory) {
50-
return factory.createChannel("local");
53+
return factory.createChannel("spring-integration");
5154
}
5255

5356
/**
@@ -58,8 +61,7 @@ ManagedChannel managedChannel(GrpcChannelFactory factory) {
5861
@Bean
5962
IntegrationFlow grpcOutboundFlowSingleResponse(ManagedChannel managedChannel) {
6063
return flow -> flow
61-
.handle(Grpc.outboundGateway(managedChannel, SimpleGrpc.class)
62-
.methodName("SayHello"));
64+
.handle(Grpc.outboundGateway(managedChannel, SimpleGrpc.class));
6365
}
6466

6567
/**
@@ -70,8 +72,7 @@ IntegrationFlow grpcOutboundFlowSingleResponse(ManagedChannel managedChannel) {
7072
@Bean
7173
IntegrationFlow grpcOutboundFlowStreamResponse(ManagedChannel managedChannel) {
7274
return flow -> flow
73-
.handle(Grpc.outboundGateway(managedChannel, SimpleGrpc.class)
74-
.methodName("StreamHello"));
75+
.handle(Grpc.outboundGateway(managedChannel, SimpleGrpc.class));
7576
}
7677

7778
/**
@@ -86,6 +87,7 @@ ApplicationRunner grpcClientSingleResponse(
8687
return args -> {
8788
HelloReply reply = new MessagingTemplate().convertSendAndReceive(grpcInputChannelSingleResponse,
8889
HelloRequest.newBuilder().setName("Jack").build(),
90+
Collections.singletonMap(GrpcHeaders.SERVICE_METHOD, "SayHello"),
8991
HelloReply.class);
9092

9193
LOGGER.info("Single response reply: " + (reply != null ? reply.getMessage() : "No reply received"));
@@ -115,6 +117,7 @@ ApplicationRunner grpcClientStreamResponse(
115117
Message<?> requestMessage = MessageBuilder
116118
.withPayload(HelloRequest.newBuilder().setName("Jane").build())
117119
.setReplyChannel(grpcStreamOutputChannel)
120+
.setHeader(GrpcHeaders.SERVICE_METHOD, "StreamHello")
118121
.build();
119122
grpcInputChannel.send(requestMessage);
120123
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# gRPC Client Configuration
2-
spring.grpc.client.channels.local.address=static://localhost:9090
2+
spring.grpc.client.channels.spring-integration.address=static://localhost:9090

build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ subprojects { subproject ->
353353
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion"
354354
mavenBom "tools.jackson:jackson-bom:$jackson3Version"
355355
mavenBom "org.junit:junit-bom:$junitJupiterVersion"
356+
mavenBom "org.springframework.grpc:spring-grpc-dependencies:$springGrpc"
356357
}
357358
}
358359

@@ -574,7 +575,7 @@ project('barrier') {
574575
dependencies {
575576
api 'org.springframework.boot:spring-boot-starter-web'
576577
api 'org.springframework.boot:spring-boot-starter-integration'
577-
api 'org.springframework.boot:spring-boot-starter-rabbitmq:4.1.0-SNAPSHOT'
578+
api 'org.springframework.boot:spring-boot-starter-amqp'
578579
api 'org.springframework.integration:spring-integration-amqp'
579580
api 'org.springframework.integration:spring-integration-http'
580581

@@ -888,14 +889,14 @@ project('grpc-client') {
888889

889890
dependencies {
890891
implementation 'org.springframework.boot:spring-boot-starter-integration'
891-
implementation "org.springframework.grpc:spring-grpc-client-spring-boot-starter:$springGrpc"
892-
implementation "org.springframework.integration:spring-integration-grpc"
892+
implementation "org.springframework.grpc:spring-grpc-client-spring-boot-starter"
893+
implementation 'org.springframework.integration:spring-integration-grpc'
893894

894895
implementation("com.google.protobuf:protobuf-java:$protobufVersion")
895896

896897
//Test
897898
testImplementation 'org.springframework.boot:spring-boot-starter-test'
898-
testImplementation "org.springframework.grpc:spring-grpc-test:$springGrpc"
899+
testImplementation "org.springframework.grpc:spring-grpc-test"
899900
}
900901

901902

0 commit comments

Comments
 (0)