public class CouchbaseServiceRegistry extends AbstractServiceRegistry
CouchbaseServiceRegistry
.
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.Modifier and Type | Field and Description |
---|---|
static com.couchbase.client.java.view.View |
ALL_SERVICES_VIEW
All services view.
|
static java.util.Collection<com.couchbase.client.java.view.View> |
ALL_VIEWS
All views.
|
static java.lang.String |
UTIL_DOCUMENT
The utils document.
|
Constructor and Description |
---|
CouchbaseServiceRegistry(CouchbaseClientFactory couchbase,
StringSerializer<RegisteredService> serviceJsonSerializer) |
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.
|
getName, publishEvent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findServiceByExactServiceId, findServiceByExactServiceName
public static final java.lang.String UTIL_DOCUMENT
public static final com.couchbase.client.java.view.View ALL_SERVICES_VIEW
public static final java.util.Collection<com.couchbase.client.java.view.View> ALL_VIEWS
public CouchbaseServiceRegistry(CouchbaseClientFactory couchbase, StringSerializer<RegisteredService> serviceJsonSerializer)
public RegisteredService save(RegisteredService service)
ServiceRegistry
service
- the service to persist.public boolean delete(RegisteredService service)
ServiceRegistry
service
- the service to remove.public java.util.List<RegisteredService> load()
ServiceRegistry
public RegisteredService findServiceById(long id)
ServiceRegistry
id
- the idpublic RegisteredService findServiceById(java.lang.String id)
ServiceRegistry
id
- the id@PreDestroy public void destroy()
public long size()
ServiceRegistry