public class ESSequenceGeneratorComponent extends DefaultComponent implements SequenceGenerator
SequenceGenerator
service on top of Elasticsearch. Since elasticsearch does not seem to
support a notion of native sequence, the implementation uses the auto-increment of the version attribute as described
in http://blogs.perl.org/users/clinton_gormley/2011/10/elasticsearchsequence-- -a-blazing-fast-ticket-server.htmlModifier and Type | Field and Description |
---|---|
static String |
IDX_NAME |
static String |
IDX_TYPE |
Constructor and Description |
---|
ESSequenceGeneratorComponent() |
Modifier and Type | Method and Description |
---|---|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
long |
getNextId(String sequenceName)
For the given sequence name, increment it and return the value
|
activate, applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerContribution, registerExtension, setLastModified, unregisterContribution, unregisterExtension
public static final String IDX_NAME
public static final String IDX_TYPE
public long getNextId(String sequenceName)
SequenceGenerator
getNextId
in interface SequenceGenerator
sequenceName
- the name of the sequencepublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextCopyright © 2015 Nuxeo SA. All rights reserved.