Browse Source

Upgrade to RSocket 1.0.0

Closes gh-25053
pull/25096/head
Rossen Stoyanchev 5 years ago
parent
commit
ef27bc4b82
  1. 2
      build.gradle
  2. 10
      spring-messaging/src/main/java/org/springframework/messaging/rsocket/MetadataEncoder.java
  3. 3
      spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java

2
build.gradle

@ -29,7 +29,7 @@ configure(allprojects) { project -> @@ -29,7 +29,7 @@ configure(allprojects) { project ->
mavenBom "com.fasterxml.jackson:jackson-bom:2.10.3"
mavenBom "io.netty:netty-bom:4.1.49.Final"
mavenBom "io.projectreactor:reactor-bom:Dysprosium-SR7"
mavenBom "io.rsocket:rsocket-bom:1.0.0-RC7"
mavenBom "io.rsocket:rsocket-bom:1.0.0"
mavenBom "org.eclipse.jetty:jetty-bom:9.4.28.v20200408"
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.72"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.5"

10
spring-messaging/src/main/java/org/springframework/messaging/rsocket/MetadataEncoder.java

@ -25,8 +25,6 @@ import java.util.regex.Pattern; @@ -25,8 +25,6 @@ import java.util.regex.Pattern;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf;
import io.rsocket.metadata.CompositeMetadataFlyweight;
import io.rsocket.metadata.TaggingMetadataFlyweight;
import io.rsocket.metadata.WellKnownMimeType;
import reactor.core.publisher.Mono;
@ -180,17 +178,18 @@ final class MetadataEncoder { @@ -180,17 +178,18 @@ final class MetadataEncoder {
Mono.fromCallable(() -> encodeEntries(this.metadataEntries));
}
@SuppressWarnings("deprecation")
private DataBuffer encodeEntries(List<MetadataEntry> entries) {
if (this.isComposite) {
CompositeByteBuf composite = this.allocator.compositeBuffer();
try {
if (this.route != null) {
CompositeMetadataFlyweight.encodeAndAddMetadata(composite, this.allocator,
io.rsocket.metadata.CompositeMetadataFlyweight.encodeAndAddMetadata(composite, this.allocator,
WellKnownMimeType.MESSAGE_RSOCKET_ROUTING, encodeRoute());
}
entries.forEach(entry -> {
Object value = entry.value();
CompositeMetadataFlyweight.encodeAndAddMetadata(
io.rsocket.metadata.CompositeMetadataFlyweight.encodeAndAddMetadata(
composite, this.allocator, entry.mimeType().toString(),
value instanceof ByteBuf ? (ByteBuf) value : PayloadUtils.asByteBuf(encodeEntry(entry)));
});
@ -220,8 +219,9 @@ final class MetadataEncoder { @@ -220,8 +219,9 @@ final class MetadataEncoder {
}
}
@SuppressWarnings("deprecation")
private ByteBuf encodeRoute() {
return TaggingMetadataFlyweight.createRoutingMetadata(
return io.rsocket.metadata.TaggingMetadataFlyweight.createRoutingMetadata(
this.allocator, Collections.singletonList(this.route)).getContent();
}

3
spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/MessagingRSocket.java

@ -20,7 +20,6 @@ import java.util.Map; @@ -20,7 +20,6 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import io.rsocket.AbstractRSocket;
import io.rsocket.ConnectionSetupPayload;
import io.rsocket.Payload;
import io.rsocket.RSocket;
@ -59,7 +58,7 @@ import org.springframework.util.RouteMatcher; @@ -59,7 +58,7 @@ import org.springframework.util.RouteMatcher;
* @author Rossen Stoyanchev
* @since 5.2
*/
class MessagingRSocket extends AbstractRSocket {
class MessagingRSocket implements RSocket {
private final MimeType dataMimeType;

Loading…
Cancel
Save