--- a/src/pyams_content_es/include.py Sun Jan 14 12:35:17 2018 +0100
+++ b/src/pyams_content_es/include.py Sun Jan 14 12:36:59 2018 +0100
@@ -21,13 +21,14 @@
import sys
# import interfaces
-from pyams_content_es.interfaces import INDEXER_HANDLER_KEY
+from pyams_content_es.interfaces import INDEXER_HANDLER_KEY, INDEXER_STARTER_KEY
from pyramid.interfaces import IApplicationCreated
# import packages
from pyams_content_es.process import ContentIndexerProcess, ContentIndexerMessageHandler
from pyams_zmq.process import process_exit_func
from pyramid.events import subscriber
+from pyramid.settings import asbool
from zope.component.globalregistry import getGlobalSiteManager
@@ -56,17 +57,18 @@
registry = getGlobalSiteManager()
settings = registry.settings
- start_handler = settings.get(INDEXER_HANDLER_KEY, False)
+ start_handler = asbool(settings.get(INDEXER_STARTER_KEY, False))
if start_handler:
process = None
# create content indexer process
try:
- process = ContentIndexerProcess(start_handler, ContentIndexerMessageHandler, registry)
- logger.debug('Starting content indexer process {0!r}...'.format(process))
+ process = ContentIndexerProcess(settings.get(INDEXER_HANDLER_KEY, '127.0.0.1:5557'),
+ ContentIndexerMessageHandler, registry)
+ logger.info('Starting Elasticsearch content indexer {0!r}...'.format(process))
process.start()
if process.is_alive():
atexit.register(process_exit_func, process=process)
- logger.debug('Started content indexer process {0!r} with PID {1}...'.format(process, process.pid))
+ logger.info('Started Elasticsearch content indexer with PID {0}...'.format(process.pid))
finally:
if process and not process.is_alive():
process.terminate()