def start_producer()

in ees_microsoft_outlook/incremental_sync_command.py [0:0]


    def start_producer(self, queue):
        """This method starts async calls for the Producer which is responsible for fetching documents from
        the Microsoft Outlook and pushing them in the shared queue
        :param queue: Shared queue to fetch the stored documents
        """
        thread_count = self.config.get_value("microsoft_outlook_sync_thread_count")
        checkpoint = Checkpoint(self.logger, self.config)

        users_accounts = self.get_accounts()
        sync_microsoft_outlook = SyncMicrosoftOutlook(
            self.config,
            self.logger,
            self.workplace_search_custom_client,
            queue,
        )

        # Logic to fetch mails from Microsoft Outlook by using multithreading approach based on saved checkpoint
        start_time, end_time = checkpoint.get_checkpoint(
            constant.CURRENT_TIME, constant.MAILS_OBJECT.lower()
        )
        time_range_list = self.get_datetime_iterable_list(start_time, end_time)
        self.create_jobs_for_mails(
            INCREMENTAL_SYNC_INDEXING,
            sync_microsoft_outlook,
            thread_count,
            users_accounts,
            time_range_list,
            end_time,
            queue,
        )

        # Logic to fetch calendars from Microsoft Outlook by using multithreading approach based on saved checkpoint
        start_time, end_time = checkpoint.get_checkpoint(
            constant.CURRENT_TIME, constant.CALENDARS_OBJECT.lower()
        )
        time_range_list = self.get_datetime_iterable_list(start_time, end_time)
        self.create_jobs_for_calendar(
            INCREMENTAL_SYNC_INDEXING,
            sync_microsoft_outlook,
            thread_count,
            users_accounts,
            time_range_list,
            end_time,
            queue,
        )

        # Logic to fetch contacts from Microsoft Outlook by using multithreading approach based on saved checkpoint
        start_time, end_time = checkpoint.get_checkpoint(
            constant.CURRENT_TIME, constant.CONTACTS_OBJECT.lower()
        )
        time_range_list = self.get_datetime_iterable_list(start_time, end_time)
        self.create_jobs_for_contacts(
            INCREMENTAL_SYNC_INDEXING,
            sync_microsoft_outlook,
            thread_count,
            users_accounts,
            time_range_list,
            end_time,
            queue,
        )

        # Logic to fetch tasks from Microsoft Outlook by using multithreading approach based on saved checkpoint
        start_time, end_time = checkpoint.get_checkpoint(
            constant.CURRENT_TIME, constant.TASKS_OBJECT.lower()
        )
        time_range_list = self.get_datetime_iterable_list(start_time, end_time)
        self.create_jobs_for_tasks(
            INCREMENTAL_SYNC_INDEXING,
            sync_microsoft_outlook,
            thread_count,
            users_accounts,
            time_range_list,
            end_time,
            queue,
        )
        self.pass_end_signal(queue)