Skip to content

Commit cfe7ad3

Browse files
committed
Clarifies post-SUBACK delay configuration property
Renames the `clusterSyncDelayInMillis` property to `postSubAckDelayForClusterSync`. This improves clarity by explicitly indicating the delay occurs after a successful SUBACK for cluster synchronization. Updates include the configuration interface, its usage, log messages, and documentation. fixes #65
1 parent 5593d9e commit cfe7ad3

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The `in.bytehue.messaging.subscriber` PID can be used to configure the subscribe
154154
|---|---|---|---|
155155
| `timeoutInMillis` | Default timeout for synchronously subscribing to the broker (in milliseconds) | Long | `15000` |
156156
| `qos` | Default QoS for subscriptions unless specified | Integer | `0` |
157-
| `clusterSyncDelayInMillis` | Cluster Sync Delay - Wait after SUBACK (in milliseconds) | Long | `0` |
157+
| `postSubAckDelayForClusterSync` | Delay in milliseconds to wait after a successful SUBACK to allow for cluster synchronization | Long | `0` |
158158

159159
#### Publisher Configuration
160160

in.bytehue.messaging.mqtt5.provider/src/main/java/in/bytehue/messaging/mqtt5/provider/MessageSubscriptionProvider.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ public final class MessageSubscriptionProvider implements MessageSubscription {
114114
@AttributeDefinition(name = "Default QoS for subscriptions unless specified", min = "0", max = "2")
115115
int qos() default 0;
116116

117-
@AttributeDefinition(name = "Cluster Sync Delay", description = "Wait after SUBACK (in milliseconds)", min = "0")
118-
long clusterSyncDelayInMillis() default 0L;
117+
@AttributeDefinition(name = "Post SUBACK Delay For Cluster Sync", description = "Delay in milliseconds to wait after a successful SUBACK "
118+
+ "to allow for cluster synchronization", min = "0")
119+
long postSubAckDelayForClusterSync() default 0L;
119120
}
120121

121122
private LogHelper logHelper;
@@ -380,12 +381,12 @@ public SubscriptionAck _subscribe(final MessageContext context) { //NOSONAR
380381

381382
future.get(config.timeoutInMillis(), MILLISECONDS);
382383

383-
long delay = config.clusterSyncDelayInMillis();
384+
long delay = config.postSubAckDelayForClusterSync();
384385
if (delay > 0) {
385-
logHelper.debug("Cluster Sync: Subscription acknowledged. Waiting {}ms for propagation...", delay);
386+
logHelper.debug("[Post SUBACK Delay] Subscription acknowledged. Waiting {}ms for cluster synchronization...", delay);
386387
// It is safe to sleep here because we are on the caller's thread, not the HiveMQ Network thread.
387388
Thread.sleep(delay);
388-
logHelper.debug("Cluster Sync: Propagation wait of {}ms finished", delay);
389+
logHelper.debug("[Post SUBACK Delay] Wait of {}ms for cluster synchronization finished", delay);
389390
}
390391

391392
return SubscriptionAck.of(stream, subscription.id);

in.bytehue.messaging.mqtt5.provider/src/test/java/in/bytehue/messaging/mqtt5/provider/MessageSubscriptionEventTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public int qos() {
123123
}
124124

125125
@Override
126-
public long clusterSyncDelayInMillis() {
126+
public long postSubAckDelayForClusterSync() {
127127
return 0;
128128
}
129129

0 commit comments

Comments
 (0)