-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add debug information for acknowledgment messages for qos 1 and 2
- Loading branch information
1 parent
2a26368
commit 4d3361d
Showing
8 changed files
with
182 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/hivemq/cli/mqtt/Mqtt5DebugIncomingQos1Interceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.hivemq.cli.mqtt; | ||
|
||
import com.hivemq.cli.utils.LoggerUtils; | ||
import com.hivemq.client.internal.mqtt.message.publish.puback.MqttPubAckBuilder; | ||
import com.hivemq.client.mqtt.mqtt5.Mqtt5ClientConfig; | ||
import com.hivemq.client.mqtt.mqtt5.advanced.interceptor.qos1.Mqtt5IncomingQos1Interceptor; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.puback.Mqtt5PubAckBuilder; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.tinylog.Logger; | ||
|
||
public class Mqtt5DebugIncomingQos1Interceptor implements Mqtt5IncomingQos1Interceptor { | ||
|
||
@Override | ||
public void onPublish( | ||
final @NotNull Mqtt5ClientConfig clientConfig, | ||
final @NotNull Mqtt5Publish publish, | ||
final @NotNull Mqtt5PubAckBuilder pubAckBuilder) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} sending PUBACK\n {}", clientPrefix, ((MqttPubAckBuilder) pubAckBuilder).build()); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/hivemq/cli/mqtt/Mqtt5DebugIncomingQos2Interceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.hivemq.cli.mqtt; | ||
|
||
import com.hivemq.cli.utils.LoggerUtils; | ||
import com.hivemq.client.internal.mqtt.message.publish.pubcomp.MqttPubCompBuilder; | ||
import com.hivemq.client.internal.mqtt.message.publish.pubrec.MqttPubRecBuilder; | ||
import com.hivemq.client.mqtt.mqtt5.Mqtt5ClientConfig; | ||
import com.hivemq.client.mqtt.mqtt5.advanced.interceptor.qos2.Mqtt5IncomingQos2Interceptor; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubcomp.Mqtt5PubCompBuilder; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubrec.Mqtt5PubRecBuilder; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubrel.Mqtt5PubRel; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.tinylog.Logger; | ||
|
||
public class Mqtt5DebugIncomingQos2Interceptor implements Mqtt5IncomingQos2Interceptor { | ||
|
||
@Override | ||
public void onPublish( | ||
@NotNull final Mqtt5ClientConfig clientConfig, | ||
@NotNull final Mqtt5Publish publish, | ||
@NotNull final Mqtt5PubRecBuilder pubRecBuilder) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} sending PUBREC\n {}", clientPrefix, ((MqttPubRecBuilder) pubRecBuilder).build()); | ||
} | ||
|
||
@Override | ||
public void onPubRel( | ||
@NotNull final Mqtt5ClientConfig clientConfig, | ||
@NotNull final Mqtt5PubRel pubRel, | ||
@NotNull final Mqtt5PubCompBuilder pubCompBuilder) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} received PUBREL\n {}", clientPrefix, pubRel); | ||
Logger.debug("{} sending PUBCOMP\n {}", clientPrefix, ((MqttPubCompBuilder) pubCompBuilder).build()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/hivemq/cli/mqtt/Mqtt5DebugOutgoingQos1Interceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.hivemq.cli.mqtt; | ||
|
||
import com.hivemq.cli.utils.LoggerUtils; | ||
import com.hivemq.client.mqtt.mqtt5.Mqtt5ClientConfig; | ||
import com.hivemq.client.mqtt.mqtt5.advanced.interceptor.qos1.Mqtt5OutgoingQos1Interceptor; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.puback.Mqtt5PubAck; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.tinylog.Logger; | ||
|
||
public class Mqtt5DebugOutgoingQos1Interceptor implements Mqtt5OutgoingQos1Interceptor { | ||
|
||
@Override | ||
public void onPubAck( | ||
final @NotNull Mqtt5ClientConfig clientConfig, | ||
final @NotNull Mqtt5Publish publish, | ||
final @NotNull Mqtt5PubAck pubAck) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} received PUBACK\n {}", clientPrefix, pubAck); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/hivemq/cli/mqtt/Mqtt5DebugOutgoingQos2Interceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.hivemq.cli.mqtt; | ||
|
||
import com.hivemq.cli.utils.LoggerUtils; | ||
import com.hivemq.client.internal.mqtt.message.publish.pubrel.MqttPubRelBuilder; | ||
import com.hivemq.client.mqtt.mqtt5.Mqtt5ClientConfig; | ||
import com.hivemq.client.mqtt.mqtt5.advanced.interceptor.qos2.Mqtt5OutgoingQos2Interceptor; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubcomp.Mqtt5PubComp; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubrec.Mqtt5PubRec; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubrel.Mqtt5PubRel; | ||
import com.hivemq.client.mqtt.mqtt5.message.publish.pubrel.Mqtt5PubRelBuilder; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.tinylog.Logger; | ||
|
||
public class Mqtt5DebugOutgoingQos2Interceptor implements Mqtt5OutgoingQos2Interceptor { | ||
|
||
@Override | ||
public void onPubRec( | ||
final @NotNull Mqtt5ClientConfig clientConfig, | ||
final @NotNull Mqtt5Publish publish, | ||
final @NotNull Mqtt5PubRec pubRec, | ||
final @NotNull Mqtt5PubRelBuilder pubRelBuilder) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} received PUBREC\n {}", clientPrefix, pubRec); | ||
Logger.debug("{} sending PUBREL\n {}", clientPrefix, ((MqttPubRelBuilder) pubRelBuilder).build()); | ||
} | ||
|
||
@Override | ||
public void onPubRecError( | ||
final @NotNull Mqtt5ClientConfig clientConfig, | ||
final @NotNull Mqtt5Publish publish, | ||
final @NotNull Mqtt5PubRec pubRec) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} received PUBREC\n {}", clientPrefix, pubRec); | ||
} | ||
|
||
@Override | ||
public void onPubComp( | ||
final @NotNull Mqtt5ClientConfig clientConfig, | ||
final @NotNull Mqtt5PubRel pubRel, | ||
final @NotNull Mqtt5PubComp pubComp) { | ||
final String clientPrefix = LoggerUtils.getClientPrefix(clientConfig); | ||
Logger.debug("{} received PUBCOMP\n {}", clientPrefix, pubComp); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters