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 void
addCallback(java.lang.String seq, ResponseCallback callback)
int
checkSignature(java.lang.String topic, byte[] randomValue, byte[] signature)
static boolean
isPrivateTopic(java.lang.String topic)
void
onAmopMsg(io.netty.channel.ChannelHandlerContext ctx, AmopMsg amopMsg)
void
onAmopResponse(io.netty.channel.ChannelHandlerContext ctx, Message msg)
void
onConnect(io.netty.channel.ChannelHandlerContext ctx)
OnConnect action.void
onDisconnect(io.netty.channel.ChannelHandlerContext ctx)
OnDisconnect action Called when one connection disconnect.void
onMessage(io.netty.channel.ChannelHandlerContext ctx, Message msg)
OnMessage action.void
onPrivateTopicRandomValue(io.netty.channel.ChannelHandlerContext ctx, AmopMsg msg)
void
onVerifyRequest(io.netty.channel.ChannelHandlerContext ctx, Message msg)
static java.lang.String
removePrivateTopicPrefix(java.lang.String topic)
void
responseVerifyRequest(io.netty.channel.ChannelHandlerContext ctx, Message msg)
void
sendUpdateTopicStatus(int valid, java.lang.String topic, java.lang.String nodeId, io.netty.channel.ChannelHandlerContext ctx)
void
setIsRunning(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:MsgHandler
OnConnect action. Called when connect success.- Specified by:
onConnect
in interfaceMsgHandler
- Parameters:
ctx
- ChannelHandlerContext of the connection from netty
-
onMessage
Description copied from interface:MsgHandler
OnMessage action. Called when one message comes from the network.- Specified by:
onMessage
in 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:MsgHandler
OnDisconnect action Called when one connection disconnect.- Specified by:
onDisconnect
in 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
-