|
36 | 36 | "default": { |
37 | 37 | "type": "tcp", |
38 | 38 | "bind": f"{args.host}:1883", |
39 | | - "max-connections": 1000, |
| 39 | + "max_connections": 1000, |
40 | 40 | }, |
41 | 41 | "tls": { |
42 | 42 | "type": "tcp", |
43 | 43 | "bind": f"{args.host}:8883", |
44 | | - "max-connections": 1000, |
45 | | - "ssl": "on", |
| 44 | + "max_connections": 1000, |
| 45 | + "ssl": True, |
46 | 46 | "cafile": args.root_ca_cert_path, |
47 | 47 | "certfile": args.server_cert_path, |
48 | 48 | "keyfile": args.server_priv_key_path, |
49 | 49 | }, |
50 | 50 | }, |
51 | | - "sys_interval": 10, |
52 | | - "auth": { |
53 | | - "allow-anonymous": True, |
54 | | - "password-file": os.path.join( |
55 | | - os.path.dirname(os.path.realpath(__file__)), "passwd" |
56 | | - ), |
57 | | - "plugins": ["auth_anonymous"], |
58 | | - }, |
59 | | - "topic-check": { |
60 | | - "enabled": True, |
61 | | - "plugins": [] |
| 51 | + "timeout_disconnect_delay": 0, |
| 52 | + "plugins": { |
| 53 | + "amqtt.plugins.logging_amqtt.EventLoggerPlugin": {}, |
| 54 | + "amqtt.plugins.logging_amqtt.PacketLoggerPlugin": {}, |
| 55 | + "amqtt.plugins.authentication.AnonymousAuthPlugin": { |
| 56 | + "allow_anonymous": True |
| 57 | + }, |
| 58 | + "amqtt.plugins.authentication.FileAuthPlugin": { |
| 59 | + "password_file": os.path.join( |
| 60 | + os.path.dirname(os.path.realpath(__file__)), "passwd" |
| 61 | + ) |
| 62 | + }, |
| 63 | + "amqtt.plugins.sys.broker.BrokerSysPlugin": { |
| 64 | + "sys_interval": 10 |
| 65 | + }, |
62 | 66 | }, |
63 | 67 | } |
64 | 68 |
|
65 | | -broker = Broker(config) |
66 | | - |
67 | 69 | async def broker_coroutine(): |
| 70 | + broker = Broker(config) |
68 | 71 | await broker.start() |
| 72 | + # Keep the broker running indefinitely |
| 73 | + await asyncio.Event().wait() |
69 | 74 |
|
70 | 75 | if __name__ == "__main__": |
71 | 76 | formatter = "[%(asctime)s] :: %(levelname)s :: %(name)s :: %(message)s" |
72 | 77 | logging.basicConfig(level=logging.DEBUG, format=formatter) |
73 | 78 |
|
74 | 79 | # Start the MQTT broker |
75 | | - asyncio.get_event_loop().run_until_complete(broker_coroutine()) |
76 | | - asyncio.get_event_loop().run_forever() |
| 80 | + asyncio.run(broker_coroutine()) |
0 commit comments