public class CouchbaseServiceRegistryDao extends AbstractServiceRegistryDao
CouchbaseServiceRegistryDao
.
A Service Registry storage backend which uses the memcached protocol.
This may seem like a weird idea until you realize that CouchBase is a
multi host NoSQL database with a memcached interface to persistent
storage which also is quite usable as a replicated ticket storage
engine for multiple front end CAS servers.Constructor and Description |
---|
CouchbaseServiceRegistryDao(CouchbaseClientFactory couchbase,
StringSerializer<RegisteredService> serviceJsonSerializer,
boolean isQueryEnabled)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
delete(RegisteredService service)
Remove the service from the data store.
|
void |
destroy()
Stops the couchbase client and cancels the initialization task if uncompleted.
|
RegisteredService |
findServiceById(long id)
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 service)
Persist the service in the data store.
|
long |
size()
Return number of records held in this service registry.
|
findServiceByExactServiceId, publishEvent
public CouchbaseServiceRegistryDao(CouchbaseClientFactory couchbase, StringSerializer<RegisteredService> serviceJsonSerializer, boolean isQueryEnabled)
couchbase
- couchbase instanceserviceJsonSerializer
- the JSON serializer to use.isQueryEnabled
- the is query enabledpublic RegisteredService save(RegisteredService service)
ServiceRegistryDao
service
- the service to persist.public boolean delete(RegisteredService service)
ServiceRegistryDao
service
- the service to remove.public java.util.List<RegisteredService> load()
ServiceRegistryDao
public RegisteredService findServiceById(long id)
ServiceRegistryDao
id
- the idpublic RegisteredService findServiceById(java.lang.String id)
ServiceRegistryDao
id
- the id@PreDestroy public void destroy()
public long size()
ServiceRegistryDao