Skip to main content
Previous section

Creating Tutorial.ExampleOperation

Here are the steps for creating Tutorial.ExampleOperation using Atelier:

  1. Create an Atelier project using an interoperability-enabled namespace. Use the namespace in which you created Tutorial.ExampleProduction.

  2. Launch the new Business Operation Wizard: click File > New > Class File. Select the Business Operation template.

  3. Enter the following information into the wizard.

    • Project: the name of your project.

    • Package: Tutorial

    • Name: ExampleOperation

    • Invocation Style: Queued

    • Operation Methods:

  4. Click Finish

  5. Add the following code to the Test method:

    Method Test(pInput As Ens.StringRequest, Output pOutput As Ens.StringResponse) As %Status{ 
        Set pResponse=##class(Ens.StringResponse).%New()
    
        if (pRequest.StringValue="")
        {
            Set pResponse.StringValue="ERROR"
            Set tSC=$$$ERROR($$$GeneralError, "Test error case")
        }
    
        else
        {
            Set pResponse.StringValue="OK"
            Set tSC=$$$OK
    
        $$$LOGINFO(pResponse.StringValue)
    
        Return tSC
        }
    }
    
    Copy code to clipboard
  6. The complete code for Tutorial.ExampleOperation should look like the following:

    Class Tutorial.ExampleProduction extends Ens.BusinessOperation {
    
    Parameter INVOCATION = "Queue";
    
    Method Test(pInput As Ens.StringRequest, Output pOutput As Ens.StringResponse) As %Status
    {
        Set pResponse=##class(Ens.StringResponse).%New()
    
        if (pRequest.StringValue="")
        {
            Set pResponse.StringValue="ERROR"
            Set tSC=$$$ERROR($$$GeneralError, "Test error case")
        }
    
        else
        {
            Set pResponse.StringValue="OK"
            Set tSC=$$$OK
    
        $$$LOGINFO(pResponse.StringValue)
    
        Return tSC
        }
    }
    
    XData MessageMap {
    <MapItems>
        <MapItem MessageType="Ens.StringRequest">
            <Method>Test</Method>
        </MapItem>
    </MapItems>
    }
    
    }
    
    
    
    
    Copy code to clipboard