Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2014 dc-square GmbH
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
Gets called when a com.dcsquare.hivemq.spi.message.PUBLISH MQTT message arrives.

This callback gets called very often, so make sure you are NOT blocking and you are using proper caching

When throwing a com.dcsquare.hivemq.spi.callback.exception.OnPublishReceivedException it's possible to optionally disconnect the publishing client.

This callback is not meant to implement authorization (= Topic Restrictions). You should use the for that purpose as this offers more fine grained actions and extension points.

Dominik Obermaier
public interface OnPublishReceivedCallback extends SynchronousCallback {

Called when a com.dcsquare.hivemq.spi.message.PUBLISH MQTT message arrives

The publish parameter references the publish object, that is sent to the subscribers, after the onPublishReceived method was called. So if you donĀ“t want your plugin to interfere in the regular publishing process, you must copy the com.dcsquare.hivemq.spi.message.PUBLISH object. Use the static copy method of the PUBLISH class for this purpose. Similar to the following code example. PUBLISH copy = PUBLISH.copy(publish);

publish the com.dcsquare.hivemq.spi.message.PUBLISH message which was sent
clientData the information of the publishing client
com.dcsquare.hivemq.spi.callback.exception.OnPublishReceivedException when the PUBLISH was invalid.
    void onPublishReceived(PUBLISH publishClientData clientDatathrows OnPublishReceivedException;
New to GrepCode? Check out our FAQ X