Configuration item disabled, but shows enabled on Namespace
I am trying to built a Task that kicks off a Workflow to pull data into HSPD, and when I try to test the Task
I keep getting TestTask+3^OSU.Workday.TerminationsTask.1 *%Exception.StatusException ERROR <Ens>ErrConfigDisabled: Configuration item 'OSU.DataSource.Workday.TermService' is disabled
But within the Namespace the OSU.DataSource.Workday.TermService shows enabled.
Here is my Task that I am using...
Class OSU.Workday.TerminationsTask Extends %SYS.Task.Definition
{
Parameter TaskName As STRING = "OSU - Workday Termination Update";
Property DaysBack As %Integer [ InitialExpression = 1 ];
Method OnTask() As %Status
{
#Dim sc as %Status
#Dim ex as %Exception.AbstractException
set sc = $$$OK
try{
// create the service
#Dim tService As OSU.DataSource.Workday.TermService
Set tServiceConfigName = "OSU.DataSource.Workday.TermService"
// Call BusinessService
$$$ThrowOnError(##class(Ens.Director).CreateBusinessService(tServiceConfigName,.tService))
// Create Request
set tRequest = ##class(OSU.Workday.Messages.InactivatedRecordsRequest).%New()
set tRequest.DaysBack = ..DaysBack
set (tHint) = ""
// Send Request to tService
$$$ThrowOnError(tService.OnProcessInput(tRequest))
}catch ex{
set tSC = ex.AsStatus()
}
quit tSC
}
ClassMethod TestTask()
{
set tTask = ##class(OSU.Workday.TerminationsTask).%New()
set tTask.DaysBack = 1
$$$ThrowOnError(tTask.OnTask())
}
/// Location and Revision of this file in Perforce (Auto-updating)
Parameter SrcVer = "$Id$";
}
Can someone help me figure out what I am doing wrong?
Comments
The CreateBusinessService method call may be creating a new service rather than using the existing component that you have defined in the production. Considering using the SendRequestAsync() call to send to the existing component. That would trigger the OnProcessInput call when the message lands in the component. Something to the effect of:
##class(Ens.BusinessService).SendRequestAsync(tServiceConfigName, tRequest)
SendRequestAsync did not work... <METHOD DOES NOT EXIST> OnTask+12^OSU.Workday.TerminationsTask.1 SendRequestAsync,Ens.BusinessService
Class My.Custom.Task Extends (%SYS.Task.Definition, Ens.BusinessService)
{
Parameter TaskName As STRING = "My Custom Task";
Property Prop1 As %Integer [ InitialExpression = 1 ];
Method OnTask() As %Status
{
set tSC = $$$OK
try{
// Define the Existing Service intended to execute the work
Set tServiceConfigName = "My.Custom.Service"
// Create the needed Message Request Parameters
set tRequest = ##class(My.Custom.Request.Message).%New()
set tRequest.Prop1 = ..Prop1
// Send message for processing
$$$ThrowOnError(##class(Ens.BusinessService).SendRequestAsync(tServiceConfigName, tRequest))
}catch ex{
set tSC = ex.AsStatus()
}
quit tSC
}
ClassMethod TestTask() As %Status
{
// Assuming that the task has already been created
set tTask = ##class(%SYS.Task).OpenId("My Custom Task")
set tTask.Prop1 = 1 // Must save to update an existing task's properties
return ##class(%SYS.Task).RunNow(tTask.%Id())
}
}Class My.Custom.Service Extends Ens.BusinessService
{
Method OnProcessInput() As %Status
{
set tSC = $$$OK
try{
// Perform the needed processing
}catch ex{
set tSC = ex.AsStatus()
}
quit tSC
}
}The task, service, and request message may need to be adjusted for your specific use cases. If you want to use SendRequestAsync as part of your solution, you need to include it as part of the class definition.
Documentation:
Scheduling Tasks - https://docs.intersystems.com/healthconnectlatest/csp/docbook/DocBook.UI.Page.cls?KEY=GSA_manage_taskmgr
%SYS.Task::RunNow - https://docs.intersystems.com/healthconnectlatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25SYS.TaskSuper#METHOD_RunNow
%SYS.Task::OpenId - https://docs.intersystems.com/healthconnectlatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25SYS.TaskSuper#METHOD_OpenId
- Note: Different from the %OpenId() call
Business Service Impl - https://docs.intersystems.com/iris20261/csp/docbook/DocBook.UI.Page.cls?KEY=EGDV_busservice#EGDV_busservice_onprocessinput
Business Service CallInternval - https://docs.intersystems.com/iris20261/csp/docbook/DocBook.UI.Page.cls?KEY=EEMA_settings_inbound#EEMA_CallInterval
- Depending on the use case, you could consider a CallInterval on the component itself. Though, for visibility purposes, I agree that a Task is likely the preferred approach.
$$$ThrowOnError(##class(Ens.BusinessService).SendRequestAsync(tServiceConfigName, tRequest))
SendRequestAsync() is an instance method, not a class method, how can this line possibly work?
You are correct, my code will not work as written.
You are not supposed to call OnProcessInput() method.
You need to IMPLEMENT OnProcessInput() and call ProcessInput().
Is your BS enabled via SDS by any chance? If yes, can you try enabling it directly and remove Enabled SDS to test?