def __init__(self, app_name, num_workers=DEFAULT_NUM_WORKERS):
        """Constructor.

        :param str app_name: application name.
        :param int num_workers: number of worker threads.
        """

        self._log = logging.getLogger(app_name)
        self._app_name = app_name
        self._stop_event = threading.Event()
        self._task_executor = ThreadPoolExecutor(max_workers=num_workers)
        self._task_limiter = threading.Semaphore(value=num_workers)
Constructor.

        :param str app_name: application name.
        :param int num_workers: number of worker threads.
        
recipes/Python/579074_Consumer_Application_Skeleton/recipe-579074.py