Firstly, to confirm that based on the Job agent and database view, the first line in the database will result in a Job agent with values such as:
machine1 = 1
and process1=23
machine2 = 0
and process2=82
and so on
If that is the intent, then a better way is to restructure the database, so there are two tables:
- Table of jobs to machine sequence looking something like this:
job |
op1 |
op2 |
op3 |
op4 |
op5 |
1 |
machine2 |
machine1 |
machine4 |
machine5 |
machine3 |
2 |
machine4 |
machine3 |
machine5 |
machine1 |
machine2 |
3 |
... |
... |
... |
... |
... |
- Table of jobs to processing time
Then, add a collection of type ArrayList
of String
to Job (let's call this collection col_machineSequence
) and when the Job agents get created their on startup
code should be:
for (String param : List.of("op1","op2","op3","op4","op5")) {
col_machineSequence.add(getParameter(param));
}
As a result, col_machineSequence
will contain sequence of machines each job should visit in the order defined in the database.
NOTE: Please see help on getParameter() here.
Also:
- Putting a Queue in front of the Service isn't necessary
- Repeating Enter-Queue-Service-Exit isn't necessary, this can be simplified using this method
Follow-up clarifications:
- Collections - these will be enclosed in each Job agent
- Queue sorting - Service block has Priorities / preemption which governs the ordering on the queue
- Create another agent for the second table (call the agent ProcessingTime and table
processing_time
) and add it to the Job agent and then load it from database filtering on p_jobid
as shown in the picture
