private int queueTasksForFilter(final TaskContext taskContext,
                                    final String nodeName,
                                    final ProcessorFilter filter,
                                    final ProgressMonitor progressMonitor,
                                    final ProcessorTaskQueue queue,
                                    final QueueProcessTasksState queueProcessTasksState) {
        try {
            LOGGER.debug("queueTasksForFilter() - processorFilter {}", filter.getFilterInfo());

            // Queue tasks for this filter.
            final int initialQueueSize = queue.size();
            final FilterProgressMonitor filterProgressMonitor = progressMonitor.logFilter(filter,
                    initialQueueSize);

            // Only try and create tasks if the processor is enabled.
            if (filter.isEnabled() && filter.getProcessor().isEnabled()) {
                info(taskContext, filter::getFilterInfo);

                // If there are any tasks for this filter that were previously created but aren't queued and
                // their associated stream is unlocked then add them to the queue here.
                final DurationTimer durationTimer = DurationTimer.start();
                final int count = queueCreatedTasks(
                        taskContext,
                        nodeName,
                        filter,
                        queue,
                        queueProcessTasksState,
                        filterProgressMonitor);
                filterProgressMonitor.logPhase(Phase.QUEUE_CREATED_TASKS, durationTimer, count);
                return count;
            }
        } catch (final RuntimeException e) {
            LOGGER.error(e.getMessage(), e);
        }
        return 0;
    }
Return the next task to perform. Called by worker threads. Also assigns
the task to the node asking for the job
stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorTaskQueueManagerImpl.java