5858import io .aklivity .zilla .runtime .engine .catalog .Catalog ;
5959import io .aklivity .zilla .runtime .engine .config .KindConfig ;
6060import io .aklivity .zilla .runtime .engine .config .NamespaceConfig ;
61+ import io .aklivity .zilla .runtime .engine .config .RouterConfig ;
6162import io .aklivity .zilla .runtime .engine .diagnostic .EngineDiagnosticsTask ;
6263import io .aklivity .zilla .runtime .engine .event .EventFormatterFactory ;
6364import io .aklivity .zilla .runtime .engine .exporter .Exporter ;
7778import io .aklivity .zilla .runtime .engine .metrics .MetricGroup ;
7879import io .aklivity .zilla .runtime .engine .model .Model ;
7980import io .aklivity .zilla .runtime .engine .namespace .NamespacedId ;
81+ import io .aklivity .zilla .runtime .engine .router .Router ;
82+ import io .aklivity .zilla .runtime .engine .router .RouterFactory ;
8083import io .aklivity .zilla .runtime .engine .store .Store ;
8184import io .aklivity .zilla .runtime .engine .vault .Vault ;
8285
@@ -99,6 +102,7 @@ public final class Engine implements Collector, AutoCloseable
99102 private final EngineConfiguration config ;
100103 private final EngineManager manager ;
101104 private final EngineDiagnosticsTask diagnostics ;
105+ private final RouterConfig routerConfig ;
102106
103107 private final EventWriter eventWriter ;
104108 private final AtomicBoolean closed ;
@@ -190,13 +194,20 @@ public final class Engine implements Collector, AutoCloseable
190194 }
191195 }
192196
197+ final Router router = RouterFactory .instantiate ().create (config .router (), config );
198+ final RouterConfig routerConfig = RouterConfig .builder ()
199+ .id (0L )
200+ .name (router .name ())
201+ .build ();
202+ this .routerConfig = routerConfig ;
203+
193204 List <EngineWorker > workers = new ArrayList <>(workerCount );
194205 for (int workerIndex = 0 ; workerIndex < workerCount ; workerIndex ++)
195206 {
196207 EngineWorker worker =
197208 new EngineWorker (config , tasks , labels , diagnoseOnError , tuning ::affinity , bindings , exporters ,
198- guards , vaults , catalogs , models , metricGroups , stores , this , this :: supplyEventReader ,
199- eventFormatterFactory , workerIndex , readonly , this ::process , boss );
209+ guards , vaults , catalogs , models , metricGroups , stores , router , routerConfig , this ,
210+ this :: supplyEventReader , eventFormatterFactory , workerIndex , readonly , this ::process , boss );
200211 workers .add (worker );
201212 }
202213 this .workers = workers ;
@@ -391,6 +402,11 @@ public Clock clock()
391402 return config .clock ();
392403 }
393404
405+ public RouterConfig routerConfig ()
406+ {
407+ return routerConfig ;
408+ }
409+
394410 public static EngineBuilder builder ()
395411 {
396412 return new EngineBuilder ();
0 commit comments