Class AbstractElasticsearchFactory<T extends AutoCloseable>

  • 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:
    ElasticsearchAdminServiceFactory

    public abstract class AbstractElasticsearchFactory<T extends AutoCloseable>
    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 extends AutoCloseable>
      • doCreateSingleInstance

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

        protected abstract T doCreateMultiInstance​(org.elasticsearch.client.RestHighLevelClient readClient,
                                                   org.elasticsearch.client.RestHighLevelClient[] 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
      • destroyInstance

        protected void destroyInstance​(T instance)
                                throws Exception
        Overrides:
        destroyInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<T extends AutoCloseable>
        Throws:
        Exception