Package io.moquette.interception
Interface InterceptHandler
-
- All Known Implementing Classes:
AbstractInterceptHandler
public interface InterceptHandlerThis interface is used to inject code for intercepting broker events.The events can act only as observers.
Almost every method receives a subclass of
MqttMessage, exceptonDisconnectthat receives the client id string andonSubscribeandonUnsubscribethat receive aSubscriptionobject.
-
-
Field Summary
Fields Modifier and Type Field Description static Class<?>[]ALL_MESSAGE_TYPES
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetID()Class<?>[]getInterceptedMessageTypes()voidonConnect(InterceptConnectMessage msg)voidonConnectionLost(InterceptConnectionLostMessage msg)voidonDisconnect(InterceptDisconnectMessage msg)voidonMessageAcknowledged(InterceptAcknowledgedMessage msg)voidonPublish(InterceptPublishMessage msg)Called when a message is published.voidonSubscribe(InterceptSubscribeMessage msg)voidonUnsubscribe(InterceptUnsubscribeMessage msg)
-
-
-
Field Detail
-
ALL_MESSAGE_TYPES
static final Class<?>[] ALL_MESSAGE_TYPES
-
-
Method Detail
-
getID
String getID()
- Returns:
- the identifier of this intercept handler.
-
getInterceptedMessageTypes
Class<?>[] getInterceptedMessageTypes()
- Returns:
- the InterceptMessage subtypes that this handler can process. If the result is null or equal to ALL_MESSAGE_TYPES, all the message types will be processed.
-
onConnect
void onConnect(InterceptConnectMessage msg)
-
onDisconnect
void onDisconnect(InterceptDisconnectMessage msg)
-
onConnectionLost
void onConnectionLost(InterceptConnectionLostMessage msg)
-
onPublish
void onPublish(InterceptPublishMessage msg)
Called when a message is published. The receiver MUST release the payload of the message, either by calling super.onPublish, or by calling msg.getPayload.release() directly.- Parameters:
msg- The message that was published.
-
onSubscribe
void onSubscribe(InterceptSubscribeMessage msg)
-
onUnsubscribe
void onUnsubscribe(InterceptUnsubscribeMessage msg)
-
onMessageAcknowledged
void onMessageAcknowledged(InterceptAcknowledgedMessage msg)
-
-