File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
examples/src/main/java/io/scalecube/examples Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 33import io .scalecube .cluster .Cluster ;
44import io .scalecube .cluster .ClusterImpl ;
55import io .scalecube .cluster .metadata .MetadataCodec ;
6+ import io .scalecube .transport .netty .websocket .WebsocketTransportFactory ;
67import java .nio .ByteBuffer ;
78import java .util .concurrent .TimeUnit ;
89
9- public class ClusterCustomMetadataEncodingExample {
10+ public class CustomMetadataEncodingExample {
1011
1112 /** Main method. */
1213 public static void main (String [] args ) throws Exception {
1314 // Start seed cluster member Alice
1415 Cluster alice =
15- new ClusterImpl ().config (opts -> opts .metadataCodec (new LongMetadataCodec ())).startAwait ();
16+ new ClusterImpl ()
17+ .transportFactory (WebsocketTransportFactory ::new )
18+ .config (opts -> opts .metadataCodec (new LongMetadataCodec ()))
19+ .startAwait ();
1620 System .out .println (
1721 "[" + alice .member ().id () + "] Alice's metadata: " + alice .metadata ().orElse (null ));
1822
1923 Cluster joe =
2024 new ClusterImpl ()
25+ .transportFactory (WebsocketTransportFactory ::new )
2126 .config (opts -> opts .metadataCodec (new LongMetadataCodec ()).metadata (123L ))
2227 .membership (opts -> opts .seedMembers (alice .address ()))
2328 .startAwait ();
@@ -26,6 +31,7 @@ public static void main(String[] args) throws Exception {
2631
2732 Cluster bob =
2833 new ClusterImpl ()
34+ .transportFactory (WebsocketTransportFactory ::new )
2935 .config (opts -> opts .metadataCodec (new LongMetadataCodec ()).metadata (456L ))
3036 .membership (opts -> opts .seedMembers (alice .address ()))
3137 .startAwait ();
You can’t perform that action at this time.
0 commit comments