public class MongoDbServiceRegistry extends AbstractServiceRegistry
Implementation of ServiceRegistry
that uses a MongoDb repository as the backend
persistence mechanism. The repository is configured by the Spring application context.
The class will automatically create a default collection to use with services. The name of the collection may be specified. It also presents the ability to drop an existing collection and start afresh.
Constructor and Description |
---|
MongoDbServiceRegistry() |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(RegisteredService svc)
Remove the service from the data store.
|
RegisteredService |
findServiceById(long svcId)
Find service by the numeric id.
|
RegisteredService |
findServiceById(java.lang.String id)
Find service by the service id.
|
java.util.List<RegisteredService> |
load()
Retrieve the services from the data store.
|
RegisteredService |
save(RegisteredService svc)
Persist the service in the data store.
|
long |
size()
Return number of records held in this service registry.
|
getName, publishEvent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findServiceByExactServiceId, findServiceByExactServiceName
public boolean delete(RegisteredService svc)
ServiceRegistry
svc
- the service to remove.public RegisteredService findServiceById(long svcId)
ServiceRegistry
svcId
- the idpublic RegisteredService findServiceById(java.lang.String id)
ServiceRegistry
id
- the idpublic java.util.List<RegisteredService> load()
ServiceRegistry
public RegisteredService save(RegisteredService svc)
ServiceRegistry
svc
- the service to persist.public long size()
ServiceRegistry