main启动

# 阻塞启动

       
         Bootstrap bootstrap = Bootstrap.builder()
                .rootLevel(Level.DEBUG)
                .tcpConfig(
                        BootstrapConfig
                                .TcpConfig
                                .builder()
                                .port(8888)
                                .username("smqtt")
                                .password("smqtt")
                                .build())
                .httpConfig(
                        BootstrapConfig
                                .HttpConfig
                                .builder()
                                .enable(true)
                                .accessLog(true)
                                .httpAdmin(BootstrapConfig.HttpAdmin.builder().enable(true).username("smqtt").password("smqtt").build())
                                .build())
                .clusterConfig(
                        BootstrapConfig.
                                ClusterConfig
                                .builder()
                                .enable(true)
                                .namespace("smqtt")
                                .node("node-1")
                                .port(7773)
                                .url("127.0.0.1:7771,127.0.0.1:7772").
                                build())
                .build()
                .startAwait();
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

# 非阻塞启动

  Bootstrap bootstrap = Bootstrap.builder()
         .rootLevel(Level.DEBUG)
         .tcpConfig(
                BootstrapConfig
                  .TcpConfig
                  .builder()
                  .port(8888)
                  .username("smqtt")
                  .password("smqtt")
                  .build())
          .httpConfig(
               BootstrapConfig
                    .HttpConfig
                     .builder()
                     .enable(true)
                     .accessLog(true)
                     .httpAdmin(BootstrapConfig.HttpAdmin.builder().enable(true).username("smqtt").password("smqtt").build())
                     .build())
          .clusterConfig(
                BootstrapConfig.
                     ClusterConfig
                      .builder()
                      .enable(true)
                      .namespace("smqtt")
                      .node("node-1")
                      .port(7773)
                      .url("127.0.0.1:7771,127.0.0.1:7772").
                       build())
          .build()
          .start().block();
          
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Last Updated: 12/5/2021, 8:33:06 AM