11package com .baeldung .rsocket ;
22
3- import com .baeldung .rsocket .support .WindDataPublisher ;
3+ import com .baeldung .rsocket .support .DataPublisher ;
44import static com .baeldung .rsocket .support .Constants .*;
55import com .baeldung .rsocket .support .GameController ;
66import io .rsocket .AbstractRSocket ;
@@ -19,7 +19,7 @@ public class Server {
1919 private static final Logger LOG = LoggerFactory .getLogger (Server .class );
2020
2121 private final Disposable server ;
22- private final WindDataPublisher windDataPublisher = new WindDataPublisher ();
22+ private final DataPublisher dataPublisher = new DataPublisher ();
2323 private final GameController gameController ;
2424
2525 public Server () {
@@ -34,7 +34,7 @@ public Server() {
3434 }
3535
3636 public void dispose () {
37- windDataPublisher .complete ();
37+ dataPublisher .complete ();
3838 this .server .dispose ();
3939 }
4040
@@ -67,7 +67,7 @@ public Mono<Payload> requestResponse(Payload payload) {
6767 @ Override
6868 public Mono <Void > fireAndForget (Payload payload ) {
6969 try {
70- windDataPublisher .publish (payload ); // forward the payload
70+ dataPublisher .publish (payload ); // forward the payload
7171 return Mono .empty ();
7272 } catch (Exception x ) {
7373 return Mono .error (x );
@@ -78,13 +78,13 @@ public Mono<Void> fireAndForget(Payload payload) {
7878 * Handle Request/Stream messages. Each request returns a new stream.
7979 *
8080 * @param payload Payload that can be used to determine which stream to return
81- * @return Flux stream containing simulated wind speed data
81+ * @return Flux stream containing simulated measurement data
8282 */
8383 @ Override
8484 public Flux <Payload > requestStream (Payload payload ) {
8585 String streamName = payload .getDataUtf8 ();
86- if (WIND_DATA_STREAM_NAME .equals (streamName )) {
87- return Flux .from (windDataPublisher );
86+ if (DATA_STREAM_NAME .equals (streamName )) {
87+ return Flux .from (dataPublisher );
8888 }
8989 return Flux .error (new IllegalArgumentException (streamName ));
9090 }
0 commit comments