· Jun 22, 2020

adding business hosts programmatically to a pre-existing production.

Hello Guys, can you help me with a issue? I think it is a beginning question, but here goes, how do I add a new business host to production programmatically? for example a new business service or business process.

I've been looking at the documentation for the classes Ens.Config.Production, Ens.Config.Item and Ens.Director and I haven't found any method to add, maybe the name is a little bit different.

The idea is to create a class that will "deploy" or "configurate" a new project components in a pre-existing production.



Discussion (7)1
Log in or sign up to continue

Add a new Business Host. If you want to add several, call CallProductionUpdateAndSaveToClass method once at the end.

Include Ensemble


Parameter DOMAIN = "Ensemble";

/// Add new Business Host.
/// productionName - name of production class
/// name - name of item you want to add
/// class - class name of the item you want to add
/// w $System.Status.GetErrorText(##class(
ClassMethod add(productionName As %Dictionary.CacheClassname = "", name As %String = "MyOperation", class As %Dictionary.CacheClassname = "")
    Set production = ##class(Ens.Config.Production).%OpenId(productionName)
    Set item = ##class(Ens.Config.Item).%New()
    Set item.PoolSize = 1
    Set item.Name = name
    Set item.ClassName = class
    Set:item.Name="" item.Name = item.ClassName
    Set item.Enabled = $$$YES
    Set sc = production.Items.Insert(item)
    Quit:$$$ISERR(sc) sc
    Set sc = $$$AuditModifyProductionConfig(production.Name,item.Name,$$$Text("Item added to production using generator in " _ $classname()))
    Quit:$$$ISERR(sc) sc   
    Set sc = ##class(EnsPortal.Template.prodConfigSCPage).CallProductionUpdateAndSaveToClass(production,"","SaveProduction")
    Quit sc