Skip to content

Commit 21c9e9c

Browse files
spencergibbolegz
authored andcommitted
Updates broker to 0.3.0
Resolves #775
1 parent 6e80c4d commit 21c9e9c

File tree

5 files changed

+37
-47
lines changed

5 files changed

+37
-47
lines changed

Diff for: pom.xml

-8
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,6 @@
172172
</profile>
173173
</profiles>
174174
<repositories>
175-
<repository>
176-
<id>rsocket-snapshots</id>
177-
<name>RSocket Snapshots</name>
178-
<url>https://oss.jfrog.org/oss-snapshot-local</url>
179-
<snapshots>
180-
<enabled>true</enabled>
181-
</snapshots>
182-
</repository>
183175
<repository>
184176
<id>spring-snapshots</id>
185177
<name>Spring Snapshots</name>

Diff for: spring-cloud-function-rsocket/pom.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</parent>
1717

1818
<properties>
19-
<rsocket-routing.version>0.1.0</rsocket-routing.version>
19+
<rsocket-broker.version>0.3.0</rsocket-broker.version>
2020
</properties>
2121

2222
<dependencies>
@@ -37,9 +37,9 @@
3737
<artifactId>spring-cloud-function-context</artifactId>
3838
</dependency>
3939
<dependency>
40-
<groupId>io.rsocket.routing</groupId>
41-
<artifactId>rsocket-routing-client-spring</artifactId>
42-
<version>${rsocket-routing.version}</version>
40+
<groupId>io.rsocket.broker</groupId>
41+
<artifactId>rsocket-broker-client-spring</artifactId>
42+
<version>${rsocket-broker.version}</version>
4343
<optional>true</optional>
4444
</dependency>
4545
<dependency>
@@ -58,9 +58,9 @@
5858
<scope>test</scope>
5959
</dependency>
6060
<dependency>
61-
<groupId>io.rsocket.routing</groupId>
62-
<artifactId>rsocket-routing-broker-spring</artifactId>
63-
<version>${rsocket-routing.version}</version>
61+
<groupId>io.rsocket.broker</groupId>
62+
<artifactId>rsocket-broker-spring</artifactId>
63+
<version>${rsocket-broker.version}</version>
6464
<scope>test</scope>
6565
</dependency>
6666
</dependencies>

Diff for: spring-cloud-function-rsocket/src/main/java/org/springframework/cloud/function/rsocket/RSocketRoutingAutoConfiguration.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.cloud.function.rsocket;
1818

19-
import io.rsocket.routing.client.spring.RoutingClientAutoConfiguration;
19+
import io.rsocket.broker.client.spring.BrokerClientAutoConfiguration;
2020

2121
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
2222
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -35,9 +35,9 @@
3535
* @since 3.1
3636
*/
3737
@Configuration(proxyBeanMethods = false)
38-
@ConditionalOnClass(RoutingClientAutoConfiguration.class)
38+
@ConditionalOnClass(BrokerClientAutoConfiguration.class)
3939
@ConditionalOnProperty(name = FunctionProperties.PREFIX + ".rsocket.enabled", matchIfMissing = true)
40-
@AutoConfigureBefore(RoutingClientAutoConfiguration.class)
40+
@AutoConfigureBefore(BrokerClientAutoConfiguration.class)
4141
@AutoConfigureAfter(RSocketAutoConfiguration.class)
4242
class RSocketRoutingAutoConfiguration {
4343

Diff for: spring-cloud-function-rsocket/src/test/java/org/springframework/cloud/function/rsocket/RoutingBrokerTests.java

+25-27
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
package org.springframework.cloud.function.rsocket;
1818

19+
import java.time.Duration;
1920
import java.util.function.Function;
2021

21-
import io.rsocket.routing.client.spring.RoutingMetadata;
22+
import io.rsocket.broker.client.spring.BrokerMetadata;
2223
import org.junit.jupiter.api.AfterEach;
2324
import org.junit.jupiter.api.Disabled;
2425
import org.junit.jupiter.api.Test;
@@ -64,7 +65,7 @@ public void cleanup() {
6465
public void testRoutingWithProperty() throws Exception {
6566
this.setup(true);
6667
RSocketRequester requester = clientContext.getBean(RSocketRequester.class);
67-
// route(uppercase) used to find function, must match io.rsocket.routing.client.address entry
68+
// route(uppercase) used to find function, must match io.rsocket.broker.client.address entry
6869
Mono<String> result = requester.route("uppercase")
6970
// auto creates metadata
7071
.data("\"hello\"")
@@ -74,14 +75,14 @@ public void testRoutingWithProperty() throws Exception {
7475
.create(result)
7576
.expectNext("HELLO")
7677
.expectComplete()
77-
.verify();
78+
.verify(Duration.ofSeconds(15));
7879
}
7980

8081
@Test
8182
public void testRoutingWithMessage() throws Exception {
8283
this.setup(false);
8384
RSocketRequester requester = clientContext.getBean(RSocketRequester.class);
84-
RoutingMetadata metadata = clientContext.getBean(RoutingMetadata.class);
85+
BrokerMetadata metadata = clientContext.getBean(BrokerMetadata.class);
8586
Mono<String> result = requester.route("uppercase") // used to find function
8687
.metadata(metadata.address("samplefn"))
8788
.data("\"hello\"")
@@ -91,41 +92,40 @@ public void testRoutingWithMessage() throws Exception {
9192
.create(result)
9293
.expectNext("HELLO")
9394
.expectComplete()
94-
.verify();
95+
.verify(Duration.ofSeconds(15));
9596
}
9697

9798
private void setup(boolean routingWithProperty) {
98-
int routingBrokerProxyPort = SocketUtils.findAvailableTcpPort();
99-
int routingBrokerClusterPort = SocketUtils.findAvailableTcpPort();
99+
int brokerProxyPort = SocketUtils.findAvailableTcpPort();
100+
int brokerClusterPort = SocketUtils.findAvailableTcpPort();
100101
// start broker
101102
brokerContext = new SpringApplicationBuilder(SimpleConfiguration.class).web(WebApplicationType.NONE).run(
102-
"--logging.level.io.rsocket.routing.broker=TRACE",
103+
"--logging.level.io.rsocket.broker=TRACE",
103104
"--spring.cloud.function.rsocket.enabled=false",
104-
"--io.rsocket.routing.client.enabled=false",
105-
"--io.rsocket.routing.broker.enabled=true",
106-
"--io.rsocket.routing.broker.tcp.port=" + routingBrokerProxyPort,
107-
"--io.rsocket.routing.broker.cluster.port=" + routingBrokerClusterPort);
105+
"--io.rsocket.broker.client.enabled=false",
106+
"--io.rsocket.broker.enabled=true",
107+
"--io.rsocket.broker.uri=tcp://localhost:" + brokerProxyPort,
108+
"--io.rsocket.broker.cluster.uri=tcp://localhost:" + brokerClusterPort);
108109

109110
// start function connecting to broker, service-name=samplefn
110111
functionContext = new SpringApplicationBuilder(SampleFunctionConfiguration.class).web(WebApplicationType.NONE)
111112
.run("--logging.level.org.springframework.cloud.function=DEBUG",
112-
"--io.rsocket.routing.client.enabled=true",
113-
"--io.rsocket.routing.client.service-name=samplefn",
114-
"--io.rsocket.routing.client.brokers[0].tcp.host=localhost",
115-
"--io.rsocket.routing.client.brokers[0].tcp.port=" + routingBrokerProxyPort,
116-
"--io.rsocket.routing.broker.enabled=false",
113+
"--logging.level.io.rsocket.broker.client=TRACE",
114+
"--io.rsocket.broker.client.enabled=true",
115+
"--io.rsocket.broker.client.service-name=samplefn",
116+
"--io.rsocket.broker.client.brokers[0]=tcp://localhost:" + brokerProxyPort,
117+
"--io.rsocket.broker.enabled=false",
117118
"--spring.cloud.function.definition=uppercase");
118119

119120
// start testclient connecting to broker, for RSocketRequester
120121
clientContext = new SpringApplicationBuilder(SimpleConfiguration.class).web(WebApplicationType.NONE).run(
121-
"--logging.level.io.rsocket.routing.client=TRACE",
122+
"--logging.level.io.rsocket.broker.client=TRACE",
122123
"--spring.cloud.function.rsocket.enabled=false",
123-
"--io.rsocket.routing.client.enabled=true",
124-
"--io.rsocket.routing.client.service-name=testclient",
125-
routingWithProperty ? "--io.rsocket.routing.client.address.uppercase.service_name=samplefn" : "",
126-
"--io.rsocket.routing.client.brokers[0].tcp.host=localhost",
127-
"--io.rsocket.routing.client.brokers[0].tcp.port=" + routingBrokerProxyPort,
128-
"--io.rsocket.routing.broker.enabled=false");
124+
"--io.rsocket.broker.client.enabled=true",
125+
"--io.rsocket.broker.client.service-name=testclient",
126+
routingWithProperty ? "--io.rsocket.broker.client.address.uppercase.service_name=samplefn" : "",
127+
"--io.rsocket.broker.client.brokers[0]=tcp://localhost:" + brokerProxyPort,
128+
"--io.rsocket.broker.enabled=false");
129129
}
130130

131131

@@ -140,9 +140,7 @@ public static class SimpleConfiguration {
140140
public static class SampleFunctionConfiguration {
141141
@Bean
142142
public Function<String, String> uppercase() {
143-
return v -> {
144-
return v.toUpperCase();
145-
};
143+
return v -> v.toUpperCase();
146144
}
147145
}
148146
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
io.rsocket.routing.broker.enabled=false
2-
io.rsocket.routing.client.enabled=false
1+
io.rsocket.broker.enabled=false
2+
io.rsocket.broker.client.enabled=false

0 commit comments

Comments
 (0)