非SpringBoot启动

# 引入依赖


<dependency>
    <artifactId>smqttx-core</artifactId>
    <groupId>io.github.quickmsg</groupId>
    <version>2.0.3</version>
</dependency>
1
2
3
4
5
6

# 启动

 Bootstrap.builder()
                .rootLevel(Level.INFO)
                .websocketConfig(
                        BootstrapConfig.WebsocketConfig
                                .builder()
                                .enable(false)
                                .path("/mqtt")
                                .port(8880)
                                .build()
                )
                .tcpConfig(
                        BootstrapConfig
                                .TcpConfig
                                .builder()
                                .port(8888)
                                .build())
                .httpConfig(
                        BootstrapConfig
                                .HttpConfig
                                .builder()
                                .enable(true)
                                .accessLog(true)
                                .admin(BootstrapConfig.HttpAdmin.builder().enable(true).username("smqtt").password("smqtt").build())
                                .build())
                .clusterConfig(
                        BootstrapConfig.
                                ClusterConfig
                                .builder()
                                .enable(false).
                                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
32
Last Updated: 11/8/2022, 6:45:52 AM