Added username to all messages. From a consumer perspective the username is more useful than a clientID which is often autogenerated.
This commit is contained in:
@@ -37,13 +37,13 @@ public interface Interceptor {
|
||||
|
||||
void notifyClientConnected(ConnectMessage msg);
|
||||
|
||||
void notifyClientDisconnected(String clientID);
|
||||
void notifyClientDisconnected(String clientID, String username);
|
||||
|
||||
void notifyTopicPublished(PublishMessage msg, String clientID);
|
||||
void notifyTopicPublished(PublishMessage msg, String clientID, final String username);
|
||||
|
||||
void notifyTopicSubscribed(Subscription sub);
|
||||
void notifyTopicSubscribed(Subscription sub, final String username);
|
||||
|
||||
void notifyTopicUnsubscribed(String topic, String clientID);
|
||||
void notifyTopicUnsubscribed(String topic, String clientID, final String username);
|
||||
|
||||
void notifyMessageConsumed(InterceptConsumedMessage msg);
|
||||
}
|
||||
|
||||
+7
-1
@@ -4,12 +4,18 @@ import static io.moquette.spi.IMessagesStore.StoredMessage;
|
||||
|
||||
public class InterceptConsumedMessage {
|
||||
final private StoredMessage msg;
|
||||
private final String username;
|
||||
|
||||
public InterceptConsumedMessage( final StoredMessage msg) {
|
||||
public InterceptConsumedMessage( final StoredMessage msg, String username) {
|
||||
this.msg = msg;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public StoredMessage getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
+22
-16
@@ -1,16 +1,22 @@
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptDisconnectMessage {
|
||||
private final String clientID;
|
||||
|
||||
public InterceptDisconnectMessage(String clientID) {
|
||||
this.clientID = clientID;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
}
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptDisconnectMessage {
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptDisconnectMessage(String clientID, String username) {
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-31
@@ -1,31 +1,37 @@
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.moquette.parser.proto.messages.PublishMessage;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptPublishMessage extends InterceptAbstractMessage {
|
||||
private final PublishMessage msg;
|
||||
private final String clientID;
|
||||
|
||||
public InterceptPublishMessage(PublishMessage msg, String clientID) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.clientID = clientID;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return msg.getTopicName();
|
||||
}
|
||||
|
||||
public ByteBuffer getPayload() {
|
||||
return msg.getPayload();
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
}
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.moquette.parser.proto.messages.PublishMessage;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptPublishMessage extends InterceptAbstractMessage {
|
||||
private final PublishMessage msg;
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptPublishMessage(PublishMessage msg, String clientID, String username) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return msg.getTopicName();
|
||||
}
|
||||
|
||||
public ByteBuffer getPayload() {
|
||||
return msg.getPayload();
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-27
@@ -1,27 +1,33 @@
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.moquette.parser.proto.messages.AbstractMessage;
|
||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptSubscribeMessage {
|
||||
private final Subscription subscription;
|
||||
|
||||
public InterceptSubscribeMessage(Subscription subscription) {
|
||||
this.subscription = subscription;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return subscription.getClientId();
|
||||
}
|
||||
|
||||
public AbstractMessage.QOSType getRequestedQos() {
|
||||
return subscription.getRequestedQos();
|
||||
}
|
||||
|
||||
public String getTopicFilter() {
|
||||
return subscription.getTopicFilter();
|
||||
}
|
||||
}
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.moquette.parser.proto.messages.AbstractMessage;
|
||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptSubscribeMessage {
|
||||
private final Subscription subscription;
|
||||
private final String username;
|
||||
|
||||
public InterceptSubscribeMessage(Subscription subscription, String username) {
|
||||
this.subscription = subscription;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return subscription.getClientId();
|
||||
}
|
||||
|
||||
public AbstractMessage.QOSType getRequestedQos() {
|
||||
return subscription.getRequestedQos();
|
||||
}
|
||||
|
||||
public String getTopicFilter() {
|
||||
return subscription.getTopicFilter();
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
+28
-22
@@ -1,22 +1,28 @@
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptUnsubscribeMessage {
|
||||
private final String topicFilter;
|
||||
private final String clientID;
|
||||
|
||||
public InterceptUnsubscribeMessage(String topicFilter, String clientID) {
|
||||
this.topicFilter = topicFilter;
|
||||
this.clientID = clientID;
|
||||
}
|
||||
|
||||
public String getTopicFilter() {
|
||||
return topicFilter;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
}
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
/**
|
||||
* @author Wagner Macedo
|
||||
*/
|
||||
public class InterceptUnsubscribeMessage {
|
||||
private final String topicFilter;
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptUnsubscribeMessage(String topicFilter, String clientID, String username) {
|
||||
this.topicFilter = topicFilter;
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getTopicFilter() {
|
||||
return topicFilter;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user