public class ChannelBase extends Object
Modifier and Type | Field and Description |
---|---|
protected Middleware |
afterAction |
protected Middleware |
beforeAction |
protected Channel |
channel |
protected ConcurrentHashMap<String,ChannelAction> |
channelActionMap |
protected Middleware |
defaultAction |
protected EndpointIdentity |
endpointIdentity |
protected Middleware |
onError |
Constructor and Description |
---|
ChannelBase(Channel channel,
EndpointIdentity endpointIdentity) |
Modifier and Type | Method and Description |
---|---|
void |
dispatch(org.json.JSONObject destinationIdentity,
String action,
org.json.JSONObject actionPayload,
AckListener ackListener)
Dispatch an action to a specified client.
|
CompletableFuture<Ack> |
dispatchAsync(org.json.JSONObject destinationIdentity,
String action,
Object actionPayload) |
String |
getChannelId() |
String |
getChannelName() |
String |
getEndpointId() |
EndpointIdentity |
getEndpointIdentity() |
String |
getName() |
String |
getUuid() |
boolean |
hasRegisteredAction(String action) |
protected boolean |
register(String action,
ChannelAction listener) |
boolean |
remove(String action)
remove the registered action
|
void |
setAfterAction(Middleware middleware)
Register an action that fires after the action.
|
void |
setBeforeAction(Middleware middleware)
Register an action that fires before the action.
|
void |
setDefaultAction(Middleware middleware)
Sets a default action.
|
void |
setOnError(Middleware middleware)
Register an error handler.
|
protected Middleware defaultAction
protected Middleware onError
protected Middleware beforeAction
protected Middleware afterAction
protected ConcurrentHashMap<String,ChannelAction> channelActionMap
protected Channel channel
protected EndpointIdentity endpointIdentity
public ChannelBase(Channel channel, EndpointIdentity endpointIdentity)
protected boolean register(String action, ChannelAction listener)
public boolean remove(String action)
action
- Name of the action to be removed.public void setDefaultAction(Middleware middleware)
middleware
- Action to be executed when a client invokes an action name that has not been registered.public void setOnError(Middleware middleware)
middleware
- Action to be executed in case of an error.public void setBeforeAction(Middleware middleware)
middleware
- Action to be executed before invoking the action.public void setAfterAction(Middleware middleware)
middleware
- Action to be executed after invoking the action.public EndpointIdentity getEndpointIdentity()
public String getChannelName()
public String getUuid()
public String getChannelId()
public String getName()
public String getEndpointId()
public boolean hasRegisteredAction(String action)
public void dispatch(org.json.JSONObject destinationIdentity, String action, org.json.JSONObject actionPayload, AckListener ackListener)
destinationIdentity
- Identity of the target client.action
- Name of the action to be invoked by the client.actionPayload
- Payload to be sent along with the action.ackListener
- AckListener for the requestpublic CompletableFuture<Ack> dispatchAsync(org.json.JSONObject destinationIdentity, String action, Object actionPayload)
Copyright © 2022. All rights reserved.