|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ServiceBus
The ServiceBus
is the primary api that client applications use to interact with the Kuali
Service Bus. It provides capabilities to retrieve services endpoints for use when needing to
invoke a service. It also provides a mechanism by which a client application can publish it's own
services to the bus.
The service bus may be backed by a service registry which can be used to locate services which
other applications have published to the service registry. The service bus will synchronize it's
known state with the of the registry, either through explicit invocations of the
synchronize()
method or on a periodic basis (the details of which are up to the
implementation).
Note that the ServiceBus
manages two primary collections of Endpoint
classes.
Those that have been published by this application (referred to as "local" endpoints) and those
which have been published by other applications (referred to as "remote" endpoints).
Endpoint
,
ServiceConfiguration
,
ServiceDefinition
Method Summary | |
---|---|
List<Endpoint> |
getAllEndpoints()
Returns an unmodifiable list of all available and online endpoints of which the service bus is aware, including both local and remote endpoints. |
Endpoint |
getConfiguredEndpoint(ServiceConfiguration serviceConfiguration)
Returns the endpoint matching the given service configuration, if one exists. |
Endpoint |
getEndpoint(QName serviceName)
Returns an available endpoint for the service with the given name. |
Endpoint |
getEndpoint(QName serviceName,
String applicationId)
Returns an available endpoint for the service with the given name which is hosted by the application with the given application id. |
List<Endpoint> |
getEndpoints(QName serviceName)
Returns an unmodifiable list of accessible endpoints that are available to the service bus with the given service name. |
List<Endpoint> |
getEndpoints(QName serviceName,
String applicationId)
Returns an unmodifiable list of accessible endpoints that are available to the service bus with the given service name for the given application id. |
String |
getInstanceId()
Returns the instance ID which identifies this client application to the service bus. |
Endpoint |
getLocalEndpoint(QName serviceName)
Returns the endpoint for the service with the given name that was published by this service bus client. |
Map<QName,Endpoint> |
getLocalEndpoints()
Returns an unmodifiable list of all services that have been published by this service bus client. |
List<Endpoint> |
getRemoteEndpoints(QName serviceName)
Returns an unmodifiable list of remotely accessible endpoints that are available in the service registry with the given service name. |
Object |
getService(QName serviceName)
Returns a proxy to the service with the given name. |
Object |
getService(QName serviceName,
String applicationId)
Returns a proxy to the service with the given name which is hosted by the application with the given application id. |
ServiceConfiguration |
publishService(ServiceDefinition serviceDefinition,
boolean synchronize)
Publish a service with the given ServiceDefinition to the service bus. |
List<ServiceConfiguration> |
publishServices(List<ServiceDefinition> serviceDefinitions,
boolean synchronize)
Functions as per publishService(ServiceDefinition, boolean) but allows for multiple
services to be published to the bus in a single operation. |
boolean |
removeService(QName serviceName,
boolean synchronize)
Removes the service from the service bus and the service registry with the given service name. |
List<Boolean> |
removeServices(List<QName> serviceNames,
boolean synchronize)
Functions as per removeService(QName, boolean) but allows for multiple services to
be removed from the bus in a single operation. |
void |
synchronize()
Synchronizes the current client's service bus with the central service registry. |
void |
synchronizeLocalServices()
Synchronizes information about the services this client is publishing with the central service registry. |
void |
synchronizeRemoteServices()
Fetches information about the current state of the remote services available in the registry and the synchronizes the current client's service bus state. |
Method Detail |
---|
String getInstanceId()
List<Endpoint> getEndpoints(QName serviceName)
IllegalArgumentException
- if serviceName is nullList<Endpoint> getEndpoints(QName serviceName, String applicationId)
serviceName
- the name of the service for which to locate an available endpointapplicationId
- the id of the application for which to locate an available endpoint for
the given service name
IllegalArgumentException
- if serviceName is nullList<Endpoint> getRemoteEndpoints(QName serviceName)
If the service bus client has also deployed a service with this name, a remoted endpoint to this service will likely also be included in this list assuming that endpoint has already been synchronized with the registry.
In most cases, it is preferable to use getEndpoints(QName)
instead of this method.
Because it will preferably return a local endpoint reference for a given service endpoint if
one is available.
IllegalArgumentException
- if serviceName is nullEndpoint getLocalEndpoint(QName serviceName)
serviceName
- the name of the service represented by the local endpoint
IllegalArgumentException
- if serviceName is nullMap<QName,Endpoint> getLocalEndpoints()
List<Endpoint> getAllEndpoints()
Endpoint getEndpoint(QName serviceName)
Based on the nature of this method, if there is more than one endpoint available for the
given name, multiple invocations of this method with the same service name may return
different Endpoint
instances each time.
serviceName
- the name of the service for which to locate an available endpoint
IllegalArgumentException
- if serviceName is nullEndpoint getEndpoint(QName serviceName, String applicationId)
getEndpoint(QName)
with the exception that it will only consider endpoints with the
given application id.
Invoking this method with a null or blank value for applicationId
is equivalent to
invoking getEndpoint(QName)
.
serviceName
- the name of the service for which to locate an available endpointapplicationId
- the id of the application for which to locate an available endpoint for
the given service name
IllegalArgumentException
- if serviceName is nullEndpoint getConfiguredEndpoint(ServiceConfiguration serviceConfiguration)
serviceConfiguration
- the service configuration by which to lookup up the endpoint
IllegalArgumentException
- if the given serviceConfiguration is nullObject getService(QName serviceName)
This proxy should additionally be thread-safe.
This method is equivalent to invoking #getEndpoint(QName).getService()
.
serviceName
- the name of the service for which to locate an available proxy
IllegalArgumentException
- if serviceName is nullObject getService(QName serviceName, String applicationId)
getService(QName)
with the exception that it will only consider endpoints with the given application id.
Invoking this method with a null or blank value for applicationId
is equivalent to
invoking getService(QName)
. This method is also equivalent to invoking
#getEndpoint(QName, String).getService()
.
serviceName
- the name of the service for which to locate an available proxyapplicationId
- the id of the application for which to locate an available proxy for the
given service name
IllegalArgumentException
- if serviceName is nullServiceConfiguration publishService(ServiceDefinition serviceDefinition, boolean synchronize)
The method also provides the ability for the service bus to immediately synchronize with the
service registry after registering the service if synchronize
is set to true
.
serviceDefinition
- the definition of the service to publish, must not be nullsynchronize
- indicates whether or not this service bus client should immediately
synchronize it's changes with the registry after registering the service.
IllegalArgumentException
- if serviceDefinition is nullsynchronize()
List<ServiceConfiguration> publishServices(List<ServiceDefinition> serviceDefinitions, boolean synchronize)
publishService(ServiceDefinition, boolean)
but allows for multiple
services to be published to the bus in a single operation. If the given list of service
definitions is empty then this method will do nothing (including skipping synchronization
with the registry if that was requested).
serviceDefinitions
- the list of definition for the services to publish, must not be
nullsynchronize
- indicates whether or not this service bus client should immediately
synchronize it's changes with the registry after registering the services.
IllegalArgumentException
- if serviceDefinitions is nullpublishService(ServiceDefinition, boolean)
,
synchronize()
boolean removeService(QName serviceName, boolean synchronize)
This method also provides the ability for the service bus to immediately synchronize with the
service registry after removing the service if synchronize
is set to true
. If
the service is not located and successfully removed, however, the sychronization will not
run.
serviceName
- the name of the service to removesynchronize
- indicates whether or not this service bus client should immediately
synchronize after removing the service
IllegalArgumentException
- if the given serviceName is nullsynchronize()
List<Boolean> removeServices(List<QName> serviceNames, boolean synchronize)
removeService(QName, boolean)
but allows for multiple services to
be removed from the bus in a single operation. If the given list of service names is empty
then this method will do nothing (including skipping synchronization with the registry if
that was requested).
If the list returned from the method contains only false responses (meaning that no services were removed) this method will skip synchronization even if it is requested.
serviceNames
- the list of names for the services to remove, must not be nullsynchronize
- indicates whether or not this service bus client should immediately
synchronize it's changes with the registry after removing the services.
IllegalArgumentException
- if serviceNames is nullremoveService(QName, boolean)
,
synchronize()
void synchronize()
Invoking this method is equivalent to invoking synchronizeLocalServices()
and
synchronizeRemoteServices()
in either order. However, the semantics vary slightly
as this method should attempt to invoke them as an atomic operation.
void synchronizeRemoteServices()
void synchronizeLocalServices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |