Class AbstractElasticsearchFactory<T>

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean
    Direct Known Subclasses:
    ElasticsearchServiceFactory

    public abstract class AbstractElasticsearchFactory<T>
    extends org.springframework.beans.factory.config.AbstractFactoryBean<T>
    implements org.springframework.beans.factory.BeanNameAware
    Base implementation for factories capable of build single or multi-cluster Elasticsearch services
    Since:
    3.1.5
    Author:
    joseross
    • Field Detail

      • name

        protected String name
        The name of the bean
    • Constructor Detail

      • AbstractElasticsearchFactory

        public AbstractElasticsearchFactory​(ElasticsearchConfig config)
    • Method Detail

      • setBeanName

        public void setBeanName​(String name)
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
      • createInstance

        protected T createInstance()
        Specified by:
        createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<T>
      • doCreateSingleInstance

        protected abstract T doCreateSingleInstance​(co.elastic.clients.elasticsearch.ElasticsearchClient client)
        Creates a service instance for a single cluster
        Parameters:
        client - the Elasticsearch client
        Returns:
        the service instance
      • doCreateMultiInstance

        protected abstract T doCreateMultiInstance​(co.elastic.clients.elasticsearch.ElasticsearchClient readClient,
                                                   co.elastic.clients.elasticsearch.ElasticsearchClient[] writeClients)
        Creates a service instance for a multiple cluster
        Parameters:
        readClient - the Elasticsearch client for read-related operations
        writeClients - the Elasticsearch clients for write-related operations
        Returns:
        the service instance