Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use overlapping session ids in MqttFlowTest #732

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mqtt-streaming/src/test/java/docs/javadsl/MqttFlowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void establishClientBidirectionalConnectionAndSubscribeToATopic()
throws InterruptedException, ExecutionException, TimeoutException {
String clientId = "source-spec/flow";
String topic = "source-spec/topic1";
ByteString uniqueSessionId = ByteString.fromString("establishClientBidirectionalConnectionAndSubscribeToATopic-session");

// #create-streaming-flow
MqttSessionSettings settings = MqttSessionSettings.create();
Expand All @@ -111,7 +112,7 @@ public void establishClientBidirectionalConnectionAndSubscribeToATopic()
Tcp.get(system).outgoingConnection("localhost", 1883);

Flow<Command<Object>, DecodeErrorOrEvent<Object>, NotUsed> mqttFlow =
Mqtt.clientSessionFlow(session, ByteString.fromString("1")).join(connection);
Mqtt.clientSessionFlow(session, uniqueSessionId).join(connection);
// #create-streaming-flow

// #run-streaming-flow
Expand Down Expand Up @@ -159,6 +160,7 @@ public void establishServerBidirectionalConnectionAndSubscribeToATopic()
throws InterruptedException, ExecutionException, TimeoutException {
String clientId = "flow-spec/flow";
String topic = "source-spec/topic1";
ByteString uniqueSessionId = ByteString.fromString("establishServerBidirectionalConnectionAndSubscribeToATopic-connection");
String host = "localhost";
int port = 9884;

Expand Down Expand Up @@ -251,7 +253,7 @@ public void establishServerBidirectionalConnectionAndSubscribeToATopic()
MqttClientSession clientSession = new ActorMqttClientSession(settings, system);

Flow<Command<Object>, DecodeErrorOrEvent<Object>, NotUsed> mqttFlow =
Mqtt.clientSessionFlow(clientSession, ByteString.fromString("1")).join(connection);
Mqtt.clientSessionFlow(clientSession, uniqueSessionId).join(connection);

Pair<SourceQueueWithComplete<Command<Object>>, CompletionStage<Publish>> run =
Source.<Command<Object>>queue(3, OverflowStrategy.fail())
Expand Down
Loading