Switched from Moquette's MQTT codec to Netty's MQTT codec ones
This commit is contained in:
@@ -4,9 +4,12 @@ import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import io.moquette.interception.messages.InterceptPublishMessage;
|
||||
import io.moquette.server.Server;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static io.moquette.spi.impl.Utils.readBytesAndRewind;
|
||||
|
||||
/**
|
||||
* Created by mackristof on 28/05/2016.
|
||||
*/
|
||||
@@ -26,7 +29,11 @@ public class HazelcastInterceptHandler extends AbstractInterceptHandler {
|
||||
|
||||
@Override
|
||||
public void onPublish(InterceptPublishMessage msg) {
|
||||
LOG.info("{} publish on {} message: {}", msg.getClientID(), msg.getTopicName(), new String(msg.getPayload().array()));
|
||||
//TODO ugly, too much array copy
|
||||
ByteBuf payload = msg.getPayload();
|
||||
byte[] payloadContent = readBytesAndRewind(payload);
|
||||
|
||||
LOG.info("{} publish on {} message: {}", msg.getClientID(), msg.getTopicName(), new String(payloadContent));
|
||||
ITopic<HazelcastMsg> topic = hz.getTopic("moquette");
|
||||
HazelcastMsg hazelcastMsg = new HazelcastMsg(msg);
|
||||
topic.publish(hazelcastMsg);
|
||||
|
||||
Reference in New Issue
Block a user