feat: implement full MQTT Go parity across 5 phases — binary protocol, auth/TLS, cross-protocol bridging, monitoring, and JetStream persistence
Phase 1: Binary MQTT 3.1.1 wire protocol with PipeReader-based parsing, full packet type dispatch, and MQTT 3.1.1 compliance checks. Phase 2: Auth pipeline routing MQTT CONNECT through AuthService, TLS transport with SslStream wrapping, pinned cert validation. Phase 3: IMessageRouter refactor (NatsClient → INatsClient), MqttNatsClientAdapter for cross-protocol bridging, MqttTopicMapper with full Go-parity topic/subject translation. Phase 4: /connz mqtt_client field population, /varz actual MQTT port. Phase 5: JetStream persistence — MqttStreamInitializer creates 5 internal streams, MqttConsumerManager for QoS 1/2 consumers, subject-keyed session/retained lookups replacing linear scans. All 503 MQTT tests and 1589 Core tests pass.
This commit is contained in:
@@ -17,6 +17,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Retained_message_not_delivered_when_subscriber_connects_after_publish()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -44,6 +45,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Non_retained_publish_delivers_to_existing_subscriber()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -71,6 +73,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Live_message_delivered_to_existing_subscriber_is_not_flagged_retained()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -98,6 +101,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Multiple_publishers_deliver_to_same_subscriber()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -133,6 +137,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Message_payload_is_not_corrupted_through_broker()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -161,6 +166,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Sequential_publishes_all_deliver()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -190,6 +196,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Multiple_topics_receive_messages_independently()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
@@ -230,6 +237,7 @@ public class MqttRetainedMessageParityTests
|
||||
public async Task Subscriber_reconnect_resubscribe_receives_new_messages()
|
||||
{
|
||||
await using var listener = new MqttListener("127.0.0.1", 0);
|
||||
listener.UseBinaryProtocol = false;
|
||||
using var cts = new CancellationTokenSource();
|
||||
await listener.StartAsync(cts.Token);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user