How to Get the Adapter State and Status of a Business Operation
How would I go about getting the adapter state of this business operation? Ideally, I would like to provide the config item name to a method—in this case, 'T_SPM_SIU'—and have the method return the adapter's state, such as "Disconnected" or "Connected," along with its status.
.png)
Comments
You can use this query in your method:
select * from Ens.Job_Enumerate()
where ConfigName ='T_SPM_SIU'
I need the Adapter State and Status of the business operation, which I do not see in the provided query.
.png)
How can I retrieve the Job Status when it is an error, along with the adapter text? In my case, I am looking for 'Error' and 'Disconnected' from my above image.
.png)
Thanks
Something like this should do the trick:
ClassMethod GetConnectionStatus(pItemName As %String, ByRef pStatus As %String, ByRef pState As %String) As %Status [ Language = objectscript ]
{
Set tStatement = ##class(%SQL.Statement).%New()
Set tSC = tStatement.%PrepareClassQuery("Ens.Util.Statistics","EnumerateJobStatus")
Return:$$$ISERR(tSC) tSC
Set tRS = tStatement.%Execute(pItemName)
If tRS.%SQLCODE = 0
{
Do tRS.%Next()
Set pStatus = tRS.%Get("Status")
Set pState = tRS.%Get("AdapterState")
Return $$$OK
}
Return $$$ERROR(5001,"Status not Found")
}
Call it with the status and state variables passed by reference:
Set sc=##class(My.Class).GetConnectionStatus("T_SPM_SIU",.status,.state)