Disable ENSEMBLE operation . Throw error

Primary tabs

Hello Community,

How do i disable an operation explicitly based on a value in a variable?

I set the ReplyCodeAction to E=D.

In the Operation Code i am throwing an explicit ERROR

THROW ##class(%Exception.General).%New("Shutting Down Operation",999,,"My own special exception")

But my operation still remains up.

Any suggestions please will be appreciated.

Thanks,

Jimmy Christian.

Answers

You can THROW or set any error while Quitting,

Both should disable, if E=D.

One quick question - have you restarted you operation after putting this Logic.. The code changes will only be effective only after operation is linked to new JOB.

You can also, try debugging your code attaching corresponding job of operation in studio.. there is no reason this should not work.

Yep !

I did restart the Operation after putting the logic. I had forgotten to set the return status to an error code.

I think E=D works when the %Status has an error code.

Thank you for help.

Regards,

Jimmy Christian.

Hello.  For a given production item name you can enable: Write ##class(Ens.Director).EnableConfigItem(Item.Name,1,0)    

or disable: Write ##class(Ens.Director).EnableConfigItem(Item.Name,0,0)  

Does that answer you question, Jimmy?

Thank you Chris. 

So to give you a little more information, i want to disable the Operation if the response i receive after sending a message is not a valid one.

If i disable using Ens.Director,  does the last message i sent gets re-queued or is  it considered processed?

Thanks,

Jimmy Christian.

E=D should work.

You don't need to throw an exception, just return error %Status from handler method.

Thank you Eduard. 

Exactly !

I forgot to set the return status to an error in Catch Block. 

I set to an error code and the Operation is down.

Thank you for help.