Browse Source

Upgrade to RSocket 1.0.0

Closes gh-25053
pull/25058/head
Rossen Stoyanchev 6 years ago
parent
commit
71d384f1f8
  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

@ -25,7 +25,7 @@ configure(allprojects) { project ->
mavenBom "com.fasterxml.jackson:jackson-bom:2.10.3" mavenBom "com.fasterxml.jackson:jackson-bom:2.10.3"
mavenBom "io.netty:netty-bom:4.1.49.Final" mavenBom "io.netty:netty-bom:4.1.49.Final"
mavenBom "io.projectreactor:reactor-bom:Dysprosium-SR7" 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.eclipse.jetty:jetty-bom:9.4.28.v20200408"
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.72" mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.72"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.5" 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;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf; import io.netty.buffer.CompositeByteBuf;
import io.rsocket.metadata.CompositeMetadataFlyweight;
import io.rsocket.metadata.TaggingMetadataFlyweight;
import io.rsocket.metadata.WellKnownMimeType; import io.rsocket.metadata.WellKnownMimeType;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
@ -180,17 +178,18 @@ final class MetadataEncoder {
Mono.fromCallable(() -> encodeEntries(this.metadataEntries)); Mono.fromCallable(() -> encodeEntries(this.metadataEntries));
} }
@SuppressWarnings("deprecation")
private DataBuffer encodeEntries(List<MetadataEntry> entries) { private DataBuffer encodeEntries(List<MetadataEntry> entries) {
if (this.isComposite) { if (this.isComposite) {
CompositeByteBuf composite = this.allocator.compositeBuffer(); CompositeByteBuf composite = this.allocator.compositeBuffer();
try { try {
if (this.route != null) { if (this.route != null) {
CompositeMetadataFlyweight.encodeAndAddMetadata(composite, this.allocator, io.rsocket.metadata.CompositeMetadataFlyweight.encodeAndAddMetadata(composite, this.allocator,
WellKnownMimeType.MESSAGE_RSOCKET_ROUTING, encodeRoute()); WellKnownMimeType.MESSAGE_RSOCKET_ROUTING, encodeRoute());
} }
entries.forEach(entry -> { entries.forEach(entry -> {
Object value = entry.value(); Object value = entry.value();
CompositeMetadataFlyweight.encodeAndAddMetadata( io.rsocket.metadata.CompositeMetadataFlyweight.encodeAndAddMetadata(
composite, this.allocator, entry.mimeType().toString(), composite, this.allocator, entry.mimeType().toString(),
value instanceof ByteBuf ? (ByteBuf) value : PayloadUtils.asByteBuf(encodeEntry(entry))); value instanceof ByteBuf ? (ByteBuf) value : PayloadUtils.asByteBuf(encodeEntry(entry)));
}); });
@ -220,8 +219,9 @@ final class MetadataEncoder {
} }
} }
@SuppressWarnings("deprecation")
private ByteBuf encodeRoute() { private ByteBuf encodeRoute() {
return TaggingMetadataFlyweight.createRoutingMetadata( return io.rsocket.metadata.TaggingMetadataFlyweight.createRoutingMetadata(
this.allocator, Collections.singletonList(this.route)).getContent(); 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;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function; import java.util.function.Function;
import io.rsocket.AbstractRSocket;
import io.rsocket.ConnectionSetupPayload; import io.rsocket.ConnectionSetupPayload;
import io.rsocket.Payload; import io.rsocket.Payload;
import io.rsocket.RSocket; import io.rsocket.RSocket;
@ -59,7 +58,7 @@ import org.springframework.util.RouteMatcher;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.2 * @since 5.2
*/ */
class MessagingRSocket extends AbstractRSocket { class MessagingRSocket implements RSocket {
private final MimeType dataMimeType; private final MimeType dataMimeType;

Loading…
Cancel
Save