public abstract class AbstractService extends java.lang.Object implements MessageReceiver
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
| Constructor and Description |
|---|
AbstractService(java.lang.String serviceName,
java.lang.String serviceEndpoint)
Constructor
|
AbstractService(java.lang.String serviceName,
java.lang.String serviceEndpoint,
int responseTime)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Configuration |
getConfiguration()
Return the configuration
|
ServiceDescription |
getServiceDescription()
Return the service description
|
abstract java.lang.Object |
invokeOperation(java.lang.String opName,
Param[] args)
Invoke service operation
|
void |
onMessage(java.lang.String message)
The service provider will notify incoming messages through this method.
|
void |
register()
Register to the service registry
|
java.lang.Object |
sendRequest(java.lang.String service,
java.lang.String destination,
boolean reply,
long responseTime,
java.lang.String opName,
java.lang.Object... params)
Send request to invoke a service with specific waiting time
|
java.lang.Object |
sendRequest(java.lang.String service,
java.lang.String destination,
boolean reply,
java.lang.String opName,
java.lang.Object... params)
Send request to invoke a service
|
void |
setServiceDescription(ServiceDescription serviceDescription)
Set the service description
|
void |
startService()
Start the service
Listen for incoming messages
|
void |
stopService()
Stop the service
|
void |
unRegister()
Un register from the service registry
|
void |
updateServiceDescription()
Helps to dynamically update the service description
|
public static final boolean DEBUG
public AbstractService(java.lang.String serviceName,
java.lang.String serviceEndpoint)
serviceName - the service nameserviceEndpoint - the service endpointpublic AbstractService(java.lang.String serviceName,
java.lang.String serviceEndpoint,
int responseTime)
serviceName - the service nameserviceEndpoint - the service endpointresponseTime - the response timepublic java.lang.Object sendRequest(java.lang.String service,
java.lang.String destination,
boolean reply,
java.lang.String opName,
java.lang.Object... params)
service - the service namedestination - the target endpointreply - requires reply or notopName - the invoked operation nameparams - parameters for the operationpublic java.lang.Object sendRequest(java.lang.String service,
java.lang.String destination,
boolean reply,
long responseTime,
java.lang.String opName,
java.lang.Object... params)
service - the service namedestination - the target endpointreply - requires reply or notresponseTime - the max time for waiting a replyopName - the invoked operation nameparams - parameters for the operationpublic void startService()
public void stopService()
public void onMessage(java.lang.String message)
MessageReceiveronMessage in interface MessageReceivermessage - the incoming messagepublic abstract java.lang.Object invokeOperation(java.lang.String opName,
Param[] args)
opName - the operation nameargs - arguments of the operationpublic void register()
public void unRegister()
public void updateServiceDescription()
public ServiceDescription getServiceDescription()
public void setServiceDescription(ServiceDescription serviceDescription)
serviceDescription - the new service descriptionpublic Configuration getConfiguration()