@@ -4,8 +4,9 @@ import at.ac.uibk.dps.cirrina.execution.`object`.context.Context
44import at.ac.uibk.dps.cirrina.execution.`object`.context.NatsContext
55import at.ac.uibk.dps.cirrina.execution.`object`.event.EventHandler
66import at.ac.uibk.dps.cirrina.execution.`object`.event.NatsEventHandler
7- import at.ac.uibk.dps.cirrina.execution.service.OptimalServiceImplementationSelector
7+ import at.ac.uibk.dps.cirrina.execution.service.RandomServiceImplementationSelector
88import at.ac.uibk.dps.cirrina.execution.service.ServiceImplementationBuilder
9+ import at.ac.uibk.dps.cirrina.io.parsing.CsmParser
910import io.opentelemetry.api.OpenTelemetry
1011import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk
1112import org.apache.logging.log4j.Level
@@ -55,16 +56,24 @@ class Cirrina {
5556 newPersistentContext().use { persistentContext ->
5657 val openTelemetry = getOpenTelemetry()
5758
58- val services = ServiceImplementationBuilder .from(listOf ()).build()
59- val serviceImplementationSelector = OptimalServiceImplementationSelector (services)
60-
59+ // Create a service implementation selector based on the parsed service implementation
60+ // bindings
61+ val serviceImplementationSelector =
62+ RandomServiceImplementationSelector (
63+ ServiceImplementationBuilder .from(
64+ CsmParser .parseServiceImplementationBindings(
65+ EnvironmentVariables .serviceBindingsPath.get()
66+ )
67+ .bindings
68+ )
69+ .build()
70+ )
71+
72+ // Create and run the runtime
6173 val runtime =
6274 Runtime (openTelemetry, serviceImplementationSelector, eventHandler, persistentContext)
6375
64- runtime.run (
65- EnvironmentVariables .applicationPath.get(),
66- EnvironmentVariables .instantiate.get(),
67- )
76+ runtime.run (EnvironmentVariables .appPath.get(), EnvironmentVariables .instantiate.get())
6877
6978 logger.info(" Done running" )
7079 }
@@ -93,21 +102,21 @@ class Cirrina {
93102
94103 // Construct a new persistent context based as configured.
95104 private fun newPersistentContext (): Context =
96- when (EnvironmentVariables .persistentContextProvider .get()) {
105+ when (EnvironmentVariables .contextProvider .get()) {
97106 PersistentContextProvider .NATS -> newNatsPersistentContext()
98107 else ->
99108 throw ConfigurationError .Unknown (
100109 " persistent context" ,
101- EnvironmentVariables .persistentContextProvider .get(),
110+ EnvironmentVariables .contextProvider .get(),
102111 )
103112 }
104113
105114 // Construct a new NATS persistent context as configured.
106115 private fun newNatsPersistentContext (): NatsContext =
107116 NatsContext (
108117 false ,
109- EnvironmentVariables .natsPersistentContextUrl .get(),
110- EnvironmentVariables .natsPersistentContextBucket .get(),
118+ EnvironmentVariables .natsContextUrl .get(),
119+ EnvironmentVariables .natsContextBucket .get(),
111120 )
112121
113122 // Construct a new OpenTelemetry instance as configured.
0 commit comments