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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publish timeout bug, increase default timeout #483

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix publish timeout bug, increase default timeout
  • Loading branch information
bmaidics committed Sep 28, 2023
commit c3f110531734d51c7e9fd91422b77cddd372b9db
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class MqttConfiguration extends Configuration
static
{
final ConfigurationDef config = new ConfigurationDef("zilla.binding.mqtt");
PUBLISH_TIMEOUT = config.property("publish.timeout", TimeUnit.SECONDS.toSeconds(30));
PUBLISH_TIMEOUT = config.property("publish.timeout", TimeUnit.SECONDS.toSeconds(2 * 60));
bmaidics marked this conversation as resolved.
Show resolved Hide resolved
CONNECT_TIMEOUT = config.property("connect.timeout", TimeUnit.SECONDS.toSeconds(3));
CONNACK_TIMEOUT = config.property("connack.timeout", TimeUnit.SECONDS.toSeconds(3));
//TODO: better default values?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3964,6 +3964,7 @@ private void doPublishAppEnd(
if (!MqttState.initialClosed(state))
{
doCancelPublishExpiration();
publishStreams.remove(topicKey);
doEnd(application, originId, routedId, initialId, initialSeq, initialAck, initialMax,
traceId, sessionId, EMPTY_OCTETS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@ public void shouldPublishMultipleMessagesWithDelay() throws Exception
k3po.finish();
}

@Test
@Configuration("server.yaml")
@Specification({
"${net}/publish.multiple.messages.with.delay/client",
"${app}/publish.multiple.messages.timeout/server"})
@Configure(name = PUBLISH_TIMEOUT_NAME, value = "1")
public void shouldPublishMultipleMessagesTimeout() throws Exception
{
k3po.start();
k3po.awaitBarrier("PUBLISHED_MESSAGE_TWO");
Thread.sleep(1500);
k3po.notifyBarrier("PUBLISH_MESSAGE_THREE");
k3po.finish();
}

@Test
@Configuration("server.yaml")
@Specification({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#
# Copyright 2021-2023 Aklivity Inc.
#
# Aklivity licenses this file to you under the Apache License,
# version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

connect "zilla://streams/app0"
option zilla:window 8192
option zilla:transmission "duplex"

write zilla:begin.ext ${mqtt:beginEx()
.typeId(zilla:id("mqtt"))
.session()
.flags("CLEAN_START")
.clientId("client")
.build()
.build()}

read zilla:begin.ext ${mqtt:matchBeginEx()
.typeId(zilla:id("mqtt"))
.session()
.flags("CLEAN_START")
.qosMax(2)
.packetSizeMax(66560)
.capabilities("RETAIN", "WILDCARD", "SUBSCRIPTION_IDS", "SHARED_SUBSCRIPTIONS")
.clientId("client")
.build()
.build()}

connected

read zilla:data.empty
read notify RECEIVED_SESSION_STATE


connect await RECEIVED_SESSION_STATE
"zilla://streams/app0"
option zilla:window 8192
option zilla:transmission "duplex"

write zilla:begin.ext ${mqtt:beginEx()
.typeId(zilla:id("mqtt"))
.publish()
.clientId("client")
.topic("sensor/one")
.build()
.build()}

connected

write zilla:data.ext ${mqtt:dataEx()
.typeId(zilla:id("mqtt"))
.publish()
.build()
.build()}

write "message1"

write zilla:data.ext ${mqtt:dataEx()
.typeId(zilla:id("mqtt"))
.publish()
.build()
.build()}

write "test"
write notify SENT_MESSAGE_TWO

write close


connect await SENT_MESSAGE_TWO
"zilla://streams/app0"
option zilla:window 8192
option zilla:transmission "duplex"

write zilla:begin.ext ${mqtt:beginEx()
.typeId(zilla:id("mqtt"))
.publish()
.clientId("client")
.topic("sensor/one")
.build()
.build()}

connected

write zilla:data.ext ${mqtt:dataEx()
.typeId(zilla:id("mqtt"))
.publish()
.build()
.build()}

write "message3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#
# Copyright 2021-2023 Aklivity Inc.
#
# Aklivity licenses this file to you under the Apache License,
# version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

accept "zilla://streams/app0"
option zilla:window 8192
option zilla:transmission "duplex"

accepted

read zilla:begin.ext ${mqtt:matchBeginEx()
.typeId(zilla:id("mqtt"))
.session()
.flags("CLEAN_START")
.clientId("client")
.build()
.build()}

write zilla:begin.ext ${mqtt:beginEx()
.typeId(zilla:id("mqtt"))
.session()
.flags("CLEAN_START")
.qosMax(2)
.packetSizeMax(66560)
.capabilities("RETAIN", "WILDCARD", "SUBSCRIPTION_IDS", "SHARED_SUBSCRIPTIONS")
.clientId("client")
.build()
.build()}

connected

write zilla:data.empty
write flush


accepted

read zilla:begin.ext ${mqtt:matchBeginEx()
.typeId(zilla:id("mqtt"))
.publish()
.clientId("client")
.topic("sensor/one")
.build()
.build()}

connected

read zilla:data.ext ${mqtt:matchDataEx()
.typeId(zilla:id("mqtt"))
.publish()
.build()
.build()}

read "message1"

read zilla:data.ext ${mqtt:matchDataEx()
.typeId(zilla:id("mqtt"))
.publish()
.build()
.build()}

read "test"

read closed

accepted

read zilla:begin.ext ${mqtt:matchBeginEx()
.typeId(zilla:id("mqtt"))
.publish()
.clientId("client")
.topic("sensor/one")
.build()
.build()}

connected

read zilla:data.ext ${mqtt:matchDataEx()
.typeId(zilla:id("mqtt"))
.publish()
.build()
.build()}

read "message3"
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ public void shouldSendMultipleMessages() throws Exception
k3po.finish();
}

@Test
@Specification({
"${app}/publish.multiple.messages.timeout/client",
"${app}/publish.multiple.messages.timeout/server"})
public void shouldPublishMultipleMessagesTimeout() throws Exception
{
k3po.finish();
}

@Test
@Specification({
"${app}/publish.with.user.property/client",
Expand Down
Loading