Based on feedback, renamed messageConsumed -> messageAcknowledged.

This commit is contained in:
Dee Eldredge
2016-03-23 23:11:09 +01:00
committed by andsel
parent 1b77e43b61
commit 1e7f6d98e7
7 changed files with 13 additions and 13 deletions
@@ -40,5 +40,5 @@ public abstract class AbstractInterceptHandler implements InterceptHandler {
public void onUnsubscribe(InterceptUnsubscribeMessage msg) {} public void onUnsubscribe(InterceptUnsubscribeMessage msg) {}
@Override @Override
public void onMessageConsumed(InterceptConsumedMessage msg) {} public void onMessageAcknowledged(InterceptAcknowledgedMessage msg) {}
} }
@@ -18,7 +18,7 @@ package io.moquette.interception;
import io.moquette.parser.proto.messages.AbstractMessage; import io.moquette.parser.proto.messages.AbstractMessage;
import io.moquette.spi.impl.subscriptions.Subscription; import io.moquette.spi.impl.subscriptions.Subscription;
import io.moquette.interception.messages.InterceptConnectMessage; import io.moquette.interception.messages.InterceptConnectMessage;
import io.moquette.interception.messages.InterceptConsumedMessage; import io.moquette.interception.messages.InterceptAcknowledgedMessage;
import io.moquette.interception.messages.InterceptDisconnectMessage; import io.moquette.interception.messages.InterceptDisconnectMessage;
import io.moquette.interception.messages.InterceptPublishMessage; import io.moquette.interception.messages.InterceptPublishMessage;
import io.moquette.interception.messages.InterceptSubscribeMessage; import io.moquette.interception.messages.InterceptSubscribeMessage;
@@ -48,5 +48,5 @@ public interface InterceptHandler {
void onUnsubscribe(InterceptUnsubscribeMessage msg); void onUnsubscribe(InterceptUnsubscribeMessage msg);
void onMessageConsumed(InterceptConsumedMessage msg); void onMessageAcknowledged(InterceptAcknowledgedMessage msg);
} }
@@ -15,7 +15,7 @@
*/ */
package io.moquette.interception; package io.moquette.interception;
import io.moquette.interception.messages.InterceptConsumedMessage; import io.moquette.interception.messages.InterceptAcknowledgedMessage;
import io.moquette.parser.proto.messages.ConnectMessage; import io.moquette.parser.proto.messages.ConnectMessage;
import io.moquette.parser.proto.messages.PublishMessage; import io.moquette.parser.proto.messages.PublishMessage;
import io.moquette.spi.impl.subscriptions.Subscription; import io.moquette.spi.impl.subscriptions.Subscription;
@@ -45,5 +45,5 @@ public interface Interceptor {
void notifyTopicUnsubscribed(String topic, String clientID, final String username); void notifyTopicUnsubscribed(String topic, String clientID, final String username);
void notifyMessageConsumed(InterceptConsumedMessage msg); void notifyMessageAcknowledged(InterceptAcknowledgedMessage msg);
} }
@@ -2,12 +2,12 @@ package io.moquette.interception.messages;
import static io.moquette.spi.IMessagesStore.StoredMessage; import static io.moquette.spi.IMessagesStore.StoredMessage;
public class InterceptConsumedMessage { public class InterceptAcknowledgedMessage {
final private StoredMessage msg; final private StoredMessage msg;
private final String username; private final String username;
private final String topic; private final String topic;
public InterceptConsumedMessage( final StoredMessage msg, final String topic, final String username) { public InterceptAcknowledgedMessage( final StoredMessage msg, final String topic, final String username) {
this.msg = msg; this.msg = msg;
this.username = username; this.username = username;
this.topic = topic; this.topic = topic;
@@ -108,12 +108,12 @@ final class BrokerInterceptor implements Interceptor {
} }
@Override @Override
public void notifyMessageConsumed( final InterceptConsumedMessage msg ) { public void notifyMessageAcknowledged( final InterceptAcknowledgedMessage msg ) {
for (final InterceptHandler handler : this.handlers) { for (final InterceptHandler handler : this.handlers) {
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
handler.onMessageConsumed(msg); handler.onMessageAcknowledged(msg);
} }
}); });
} }
@@ -34,7 +34,7 @@ import io.moquette.spi.impl.subscriptions.Subscription;
import static io.moquette.parser.netty.Utils.VERSION_3_1; import static io.moquette.parser.netty.Utils.VERSION_3_1;
import static io.moquette.parser.netty.Utils.VERSION_3_1_1; import static io.moquette.parser.netty.Utils.VERSION_3_1_1;
import io.moquette.interception.messages.InterceptConsumedMessage; import io.moquette.interception.messages.InterceptAcknowledgedMessage;
import io.moquette.parser.proto.messages.AbstractMessage; import io.moquette.parser.proto.messages.AbstractMessage;
import io.moquette.parser.proto.messages.AbstractMessage.QOSType; import io.moquette.parser.proto.messages.AbstractMessage.QOSType;
import io.moquette.parser.proto.messages.ConnAckMessage; import io.moquette.parser.proto.messages.ConnAckMessage;
@@ -290,7 +290,7 @@ public class ProtocolProcessor {
String topic = inflightMsg.getTopic(); String topic = inflightMsg.getTopic();
m_interceptor.notifyMessageConsumed(new InterceptConsumedMessage(inflightMsg, topic, username)); m_interceptor.notifyMessageAcknowledged(new InterceptAcknowledgedMessage(inflightMsg, topic, username));
} }
private void verifyToActivate(String clientID, ClientSession targetSession) { private void verifyToActivate(String clientID, ClientSession targetSession) {
@@ -590,7 +590,7 @@ public class ProtocolProcessor {
targetSession.secondPhaseAcknowledged(messageID); targetSession.secondPhaseAcknowledged(messageID);
String username = NettyUtils.userName(channel); String username = NettyUtils.userName(channel);
String topic = inflightMsg.getTopic(); String topic = inflightMsg.getTopic();
m_interceptor.notifyMessageConsumed( new InterceptConsumedMessage(inflightMsg, topic, username) ); m_interceptor.notifyMessageAcknowledged( new InterceptAcknowledgedMessage(inflightMsg, topic, username) );
} }
public void processDisconnect(Channel channel) { public void processDisconnect(Channel channel) {
@@ -65,7 +65,7 @@ public class BrokerInterceptorTest {
} }
@Override @Override
public void onMessageConsumed( InterceptConsumedMessage msg ) { public void onMessageAcknowledged( InterceptAcknowledgedMessage msg ) {
n.set(90); n.set(90);
} }
} }