Create Production programmatically
I'm playing with ZPM. Accidentally dropped a production. How can I recreate it programmatically? I see Ens.Director.StartProduction, StopProduction, and even DeleteProduction but I don't see CreateProduction anywhere. Please help 😊
Product version: IRIS 2023.2
Discussion (2)2
Comments
It seems to me that I found the answer (was googling for two hours and found nothing, then used forum search and voila):
- Declare a class which inherits Ens.Production:
Class My.Production Extends Ens.Production
{
XData ProductionDefinition
{
<Production Name="My.Production" TestingEnabled="true" LogGeneralTraceEvents="true">
<Description></Description>
<ActorPoolSize>1</ActorPoolSize>
</Production>
}
}
- And launch:
Set isProductionRunning = ##class(Ens.Director).IsProductionRunning("My.Production")
If isProductionRunning = 0 {
Set sc = ##class(Ens.Director).StartProduction("My.Production")
}
And if you want to autostart the production:
set production = "Your.Production"
set ^Ens.Configuration("csp","LastProduction") = production
do ##class(Ens.Director).SetAutoStart(production)