Package org.fisco.bcos.sdk.amop.topic
Class AmopMsgHandler
java.lang.Object
org.fisco.bcos.sdk.amop.topic.AmopMsgHandler
- All Implemented Interfaces:
MsgHandler
public class AmopMsgHandler extends java.lang.Object implements MsgHandler
-
Constructor Summary
Constructors Constructor Description AmopMsgHandler(Channel channel, TopicManager topicManager) -
Method Summary
Modifier and Type Method Description voidaddCallback(java.lang.String seq, ResponseCallback callback)intcheckSignature(java.lang.String topic, byte[] randomValue, byte[] signature)static booleanisPrivateTopic(java.lang.String topic)voidonAmopMsg(io.netty.channel.ChannelHandlerContext ctx, AmopMsg amopMsg)voidonAmopResponse(io.netty.channel.ChannelHandlerContext ctx, Message msg)voidonConnect(io.netty.channel.ChannelHandlerContext ctx)OnConnect action.voidonDisconnect(io.netty.channel.ChannelHandlerContext ctx)OnDisconnect action Called when one connection disconnect.voidonMessage(io.netty.channel.ChannelHandlerContext ctx, Message msg)OnMessage action.voidonPrivateTopicRandomValue(io.netty.channel.ChannelHandlerContext ctx, AmopMsg msg)voidonVerifyRequest(io.netty.channel.ChannelHandlerContext ctx, Message msg)static java.lang.StringremovePrivateTopicPrefix(java.lang.String topic)voidresponseVerifyRequest(io.netty.channel.ChannelHandlerContext ctx, Message msg)voidsendUpdateTopicStatus(int valid, java.lang.String topic, java.lang.String nodeId, io.netty.channel.ChannelHandlerContext ctx)voidsetIsRunning(boolean isRunning)
-
Constructor Details
-
Method Details
-
setIsRunning
public void setIsRunning(boolean isRunning) -
onConnect
public void onConnect(io.netty.channel.ChannelHandlerContext ctx)Description copied from interface:MsgHandlerOnConnect action. Called when connect success.- Specified by:
onConnectin interfaceMsgHandler- Parameters:
ctx- ChannelHandlerContext of the connection from netty
-
onMessage
Description copied from interface:MsgHandlerOnMessage action. Called when one message comes from the network.- Specified by:
onMessagein interfaceMsgHandler- Parameters:
ctx- ChannelHandlerContext of the connection from nettymsg- Message from the network
-
onDisconnect
public void onDisconnect(io.netty.channel.ChannelHandlerContext ctx)Description copied from interface:MsgHandlerOnDisconnect action Called when one connection disconnect.- Specified by:
onDisconnectin interfaceMsgHandler- Parameters:
ctx- ChannelHandlerContext of the connection from netty
-
onVerifyRequest
-
responseVerifyRequest
-
checkSignature
public int checkSignature(java.lang.String topic, byte[] randomValue, byte[] signature) -
isPrivateTopic
public static boolean isPrivateTopic(java.lang.String topic) -
removePrivateTopicPrefix
public static java.lang.String removePrivateTopicPrefix(java.lang.String topic) -
onPrivateTopicRandomValue
-
onAmopMsg
-
onAmopResponse
-
sendUpdateTopicStatus
public void sendUpdateTopicStatus(int valid, java.lang.String topic, java.lang.String nodeId, io.netty.channel.ChannelHandlerContext ctx) throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
addCallback
-