Layer7 API Management

  • 1.  Stop Processing and Exit from Policy

    Posted May 18, 2018 06:42 AM

    Hi,

     

    I want to set a flag and on the basis of flag, I want to process it further.

    Condition1: If this flag is true, I should stop the processing here and return a success message to the client and exit from policy.

    Condition2: If the flag is not true(Otherwise), I want to continue processing. Or, I want to do some furthur logic in policy.

     

    When I try to use stop processing assertion or raise an error assertion, it is actually throwing an error in stead of success response. It also says unhandled exception in audit logs.

     

    Please suggest how can I proceed.

     

    Thanks,

    Ravish



  • 2.  Re: Stop Processing and Exit from Policy

    Broadcom Employee
    Posted May 20, 2018 08:56 PM

    Dear Ravish,

    Stop processing always return failure, raise error will terminate the policy execution. What you see is expected.

    Use Return template response assertion instead of stop processing assertion to return successful message, by default it won't exit the policy, but if you have option "Send response immediately" checked, it will exit policy immediately after return response assertion.

     

    Regards,

    Mark



  • 3.  Re: Stop Processing and Exit from Policy

    Posted May 21, 2018 07:54 AM

    Hi Mark,

    I used return template assertion, but it doesn't exit policy, and it goes to next assertions.

     

    Regards,

    Ravish



  • 4.  Re: Stop Processing and Exit from Policy

    Broadcom Employee
    Posted May 21, 2018 12:35 PM

    When you implemented the return template response did you check the box that returns response immediately? 

     

    Here is the snippet from the CA Wiki:

     

    Send Response immediately

    Select this check box to send the template response message immediately, with or without a payload. The transmission of a payload depends on the status code (for example, a '204 (No Content) response status indicates to skip payload transmission).

    Clear this check box to send the template response at the completion of the policy.

    WARNING: Do not enable this option for most common use cases. Doing so closes the connection immediately and disables keep-alive, causing significant performance degradation. Additionally, the Gateway will apply no WS-Security decoration to the response message.

     

     

    Return Template Response to Requestor Assertion - CA API Gateway - 9.3 - CA Technologies Documentation  here is the full page. 



  • 5.  Re: Stop Processing and Exit from Policy

    Posted May 31, 2018 06:21 AM

    I did the same. It exits from the loop. But, it starts following next assertion. That I don't want. I want to exit from policy itself.



  • 6.  Re: Stop Processing and Exit from Policy
    Best Answer

    Posted May 31, 2018 09:08 AM

    The stop will just fail this branch, so in an At least one assertion it will go the the next branch.

    If using stop, you should organise your assertions around it to get the execution flow needed (e.g. before the stop you can set a variable and check on this in next exeution branches).

     

    Btw you will mostly see this assertion used in error situations.