Package org.fisco.bcos.sdk.amop
Class AmopImp
java.lang.Object
org.fisco.bcos.sdk.amop.AmopImp
- All Implemented Interfaces:
Amop
public class AmopImp extends java.lang.Object implements Amop
Amop implement
-
Constructor Summary
Constructors Constructor Description AmopImp(Channel channel, ConfigOption config)
-
Method Summary
Modifier and Type Method Description void
broadcastAmopMsg(AmopMsgOut content)
Send amop msgjava.util.Set<java.lang.String>
getAllTopics()
java.util.Set<java.lang.String>
getSubTopics()
Get all subscribe topics.TopicManager
getTopicManager()
void
publishPrivateTopic(java.lang.String topicName, java.util.List<KeyTool> publicKeyTools)
Config a topic which is need verification, after that user can send message to verified subscriber.void
sendAmopMsg(AmopMsgOut content, AmopResponseCallback callback)
Send amop msgvoid
sendSubscribe()
void
setCallback(AmopCallback cb)
set amop default callbackvoid
start()
Start.void
stop()
Stop.void
subscribePrivateTopics(java.lang.String topicName, KeyTool privateKeyTool, AmopCallback callback)
Subscribe a private topic which need verify.void
subscribeTopic(java.lang.String topicName, AmopCallback callback)
Subscribe a normal topic.void
unsubscribeTopic(java.lang.String topicName)
Unsubscribe a topic.
-
Constructor Details
-
Method Details
-
subscribeTopic
Description copied from interface:Amop
Subscribe a normal topic.- Specified by:
subscribeTopic
in interfaceAmop
- Parameters:
topicName
- the topic namecallback
- callback is called when receive a msg relate to this topic
-
subscribePrivateTopics
public void subscribePrivateTopics(java.lang.String topicName, KeyTool privateKeyTool, AmopCallback callback)Description copied from interface:Amop
Subscribe a private topic which need verify.- Specified by:
subscribePrivateTopics
in interfaceAmop
- Parameters:
topicName
- the topic nameprivateKeyTool
- the private key you used to prove your identity.callback
- callback is called when receive a msg relate to this topic
-
publishPrivateTopic
public void publishPrivateTopic(java.lang.String topicName, java.util.List<KeyTool> publicKeyTools)Description copied from interface:Amop
Config a topic which is need verification, after that user can send message to verified subscriber.- Specified by:
publishPrivateTopic
in interfaceAmop
- Parameters:
topicName
- the topic namepublicKeyTools
- the public keys of the target organizations that you want to communicate with
-
unsubscribeTopic
public void unsubscribeTopic(java.lang.String topicName)Description copied from interface:Amop
Unsubscribe a topic.- Specified by:
unsubscribeTopic
in interfaceAmop
- Parameters:
topicName
- the topic name
-
sendAmopMsg
Description copied from interface:Amop
Send amop msg- Specified by:
sendAmopMsg
in interfaceAmop
- Parameters:
content
- the sent messagecallback
- the callback that will be called when receive the AMOP response
-
broadcastAmopMsg
Description copied from interface:Amop
Send amop msg- Specified by:
broadcastAmopMsg
in interfaceAmop
- Parameters:
content
- the broadcasted AMOP message
-
getSubTopics
public java.util.Set<java.lang.String> getSubTopics()Description copied from interface:Amop
Get all subscribe topics.- Specified by:
getSubTopics
in interfaceAmop
- Returns:
- topic name list
-
setCallback
Description copied from interface:Amop
set amop default callback- Specified by:
setCallback
in interfaceAmop
- Parameters:
cb
- the amop callback
-
start
public void start()Description copied from interface:Amop
Start. -
stop
public void stop()Description copied from interface:Amop
Stop. -
sendSubscribe
public void sendSubscribe()- Specified by:
sendSubscribe
in interfaceAmop
-
getAllTopics
public java.util.Set<java.lang.String> getAllTopics() -
getTopicManager
- Specified by:
getTopicManager
in interfaceAmop
-