1classdef Dispatcher < OutputSection
2 % Dispatcher Output section
for routing jobs to downstream destinations
4 % Dispatcher implements an output section that routes completed jobs to
5 % their next destinations according to specified routing strategies. It
6 % manages
class-dependent routing decisions and coordinates job flow
7 % through the queueing network topology.
9 % @brief Output section
for class-dependent job routing and dispatching
11 % Key characteristics:
12 % - Class-dependent routing strategies
13 % - Destination selection and job dispatching
14 % - Support
for various routing policies
15 % - Integration with network topology
16 % - Probabilistic and deterministic routing
18 % Dispatcher features:
19 % - Routing strategy management per
class
20 % - Destination probability specification
21 % - Random, round-robin, and custom routing
22 % - Class-based routing differentiation
23 % - Network flow coordination
25 % Dispatcher
is used in:
26 % - Queue output sections
for job routing
27 % - Router
nodes for traffic distribution
28 % - Load balancing implementations
29 % - Multi-path network routing
30 % - Class-based service differentiation
34 %
classes = {OpenClass(model,
'WebReq'), OpenClass(model,
'DBReq')};
35 % dispatcher = Dispatcher(
classes);
36 % dispatcher.setStrategy(
classes{1}, RoutingStrategy.PROB);
39 % Copyright (c) 2012-2026, Imperial College London
40 % All rights reserved.
44 function self = Dispatcher(customerClasses)
45 % SELF = DISPATCHER(CUSTOMERCLASSES)
47 self@OutputSection('Dispatcher');
48 self.outputStrategy = {};
49 initDispatcherJobClasses(self, customerClasses);
54 function initDispatcherJobClasses(self, customerClasses)
55 % INITDISPATCHERJOBCLASSES(CUSTOMERCLASSES)
57 for r = 1 : length(customerClasses)
58 self.outputStrategy{r} = {customerClasses{r}.name, RoutingStrategy.toText(RoutingStrategy.DISABLED)};
62 function setStrategy(self, customerClasses, strategy)
63 % SETSTRATEGY(CUSTOMERCLASSES, STRATEGY)
65 if length(strategy)==1 %#ok<ISCL>
66 self.outputStrategy{customerClasses{r}.index} = {customerClasses{r}.name, strategy};
68 for r = 1 : length(customerClasses)
69 self.outputStrategy{customerClasses{r}.index} = {customerClasses{r}.name, strategy{r}};