com.godmao.mqbroker.handler.HeartbeatMessageEncoderHandler Maven / Gradle / Ivy
package com.godmao.mqbroker.handler;
import com.godmao.mqbroker.message.HeartbeatMessage;
import com.godmao.netty.handler.AbstractEncoderHandler;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelHandler;
@ChannelHandler.Sharable
public class HeartbeatMessageEncoderHandler extends AbstractEncoderHandler {
public static final HeartbeatMessageEncoderHandler INSTANCE = new HeartbeatMessageEncoderHandler();
@Override
public ByteBuf encode(HeartbeatMessage.Response msg) {
ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(1);
byteBuf.writeByte(msg.getCmd());
return byteBuf;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy