public abstract class BaseNode extends java.lang.Object implements java.lang.Runnable, BusClient.Handler
onCreate() | onJoin() -- try join again -----<-- | | bus client main loop | | | onExit() -- exit on exception -->-- | onDestroy()
Modifier and Type | Field and Description |
---|---|
protected BusClient |
bc |
static java.lang.String |
DEFAULT_BUS_SERVER |
Constructor and Description |
---|
BaseNode() |
Modifier and Type | Method and Description |
---|---|
void |
dump(java.io.PrintWriter pw) |
java.lang.String |
getAddress() |
int |
getBufferSize()
invoked when this node need larger buffer for communication
|
BusClient |
getBusClient() |
abstract java.lang.String |
getName() |
boolean |
isRunning() |
void |
onCreate()
invoked when this node is created
|
void |
onDestroy()
invoked when this node is being destroyed
|
void |
onExit()
invoked when this node exit from bus
|
void |
onJoin()
invoked when this node join bus
|
void |
onMessage(java.lang.String topic,
byte[]... parts)
invoked when topic received.
|
void |
publishSticky(java.lang.String topic,
java.lang.String... parts)
The topic will always be delivered to subscribers
1.
|
void |
removeSticky(java.lang.String topic)
The topic will be not sticky anymore
Remove the recent sticky topic kept in memory
|
void |
run() |
boolean |
start() |
boolean |
stop() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onCall
protected BusClient bc
public static java.lang.String DEFAULT_BUS_SERVER
public abstract java.lang.String getName()
public void onCreate()
public void onJoin()
public void onExit()
public void onDestroy()
public java.lang.String getAddress()
public void onMessage(java.lang.String topic, byte[]... parts) throws java.lang.Exception
only handle bus.event in BaseNode
onMessage
in interface BusClient.Handler
topic
- parts
- java.lang.Exception
public void dump(java.io.PrintWriter pw)
public int getBufferSize()
public final BusClient getBusClient()
public void run()
run
in interface java.lang.Runnable
public final boolean isRunning()
public final boolean start()
public final boolean stop()
public void publishSticky(java.lang.String topic, java.lang.String... parts)
topic
- sticky topic to publishparts
- contentpublic void removeSticky(java.lang.String topic)
topic
- sticky topic to remove