What are the patterns / types of task queues? Can a multi-level task queue exist as an N-tree?

I still have not found a widespread template for the following situation:

There is a three-level series of tasks in the database.

  • The main task: to collect data for user X; report data;
  • Assumption: make sure all data is extracted and correct; report success or error
  • Minimum task: to get a part of the data from the network, match it with some template (described by both levels above); Report I / O errors or pattern matching errors.

Currently, I am sure that I have a comparator object that checks the minimum state of the task, and two transactional machines with two states, first to check the minimum task and the second to implement state promotion at all three levels.

But I don’t want to write braindead code that will suffer only due to the fact that methods for accessing task states are distributed between sub-objects / methods, therefore parent-state-> child-state-> action-state relationships seem like a bad idea, in resulting in if ($ level1object-> subtasks-> subtasks-> subtasks_completed) {...}.

The boilerplate code must either look clean, have only methods getNextMiniTask .. getErrorStateForMainTask, or use some other architecture to view tasks.

, . , Java, SQL/Hibernate, PHP.

P.S. , n- , - . , .

+1
1

+1

Source: https://habr.com/ru/post/1736608/


All Articles