You are correct, my code will not work as written.
- Log in to post comments
You are correct, my code will not work as written.
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
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
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)
Here is a more detailed breakdown of the default set of roles provided by HealthShare:
https://docs.intersystems.com/hs20242/csp/docbook/DocBook.UI.Page.cls?K…
If you are working on a mirrored system, please use the supported APIs to add new roles and resources otherwise you will have to manually create them on each mirror member:
https://docs.intersystems.com/hs20242/csp/docbook/DocBook.UI.Page.cls?K…
Updated documentation link for Example 1: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…
Hi Abhinav -
The SYNC issues can happen for a number of reasons, but one you should ensure is that the REGISTRY instance is up and running and that all of the REGISTRY's 'Sync' components are not producing any errors.
Please reach out to the WRC +1(617)621-0700 or support@intersystems.com about this issue.
Cheers,
Zachary N
Hi Ephraim - If you are a supported customer (with the license under support - SUTA), please contact WRC. More details you can find at https://www.intersystems.com/support/