Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better documentation with sample for Sequence BE #3448

Open
dushansachinda opened this issue Dec 11, 2024 · 2 comments
Open

Provide better documentation with sample for Sequence BE #3448

dushansachinda opened this issue Dec 11, 2024 · 2 comments

Comments

@dushansachinda
Copy link

dushansachinda commented Dec 11, 2024

Current Limitation

$subject. For someone new, it may be unclear what this is all about. Therefore, it’s recommended to provide scenario based samples along with clear documentation outlining the pros, cons, and limitations.

https://apim.docs.wso2.com/en/latest/tutorials/create-and-publish-a-sequencebackend-api/

Suggested Improvement

Document improvement with scenario

Version

No response

@dushansachinda
Copy link
Author

I've also created a BE sequence as follows engaged to the API, but it failed with

[2024-12-11 11:58:39,525] WARN - Axis2Sender Trying to send a response to an already responded client request - Rest API Context : /seqbescenario/1.0.0
[2024-12-11 11:58:43,491] INFO - LogMediator {api:seqBEScenario:v1.0.0} To: /seqbescenario/1.0.0, MessageID: urn:uuid:d343c100-6f43-4215-90fa-b9ec9246ef5a, correlation_id: d343c100-6f43-4215-90fa-b9ec9246ef5a, Direction: request, Start = Aggregate API Calls Sequence Started, Envelope: <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">soapenv:Body/</soapenv:Envelope>
[2024-12-11 11:58:43,493] INFO - LogMediator {api:seqBEScenario:v1.0.0} To: /seqbescenario/1.0.0, MessageID: urn:uuid:d343c100-6f43-4215-90fa-b9ec9246ef5a, correlation_id: d343c100-6f43-4215-90fa-b9ec9246ef5a, Direction: request, Start = Aggregate API Calls Sequence Started #1, Envelope: <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">soapenv:Body/</soapenv:Envelope>
[2024-12-11 11:58:43,676] ERROR - ContinuationStackManager Sequence : sequenceBEsample not found
[2024-12-11 11:58:43,680] INFO - LogMediator {api:seqBEScenario:v1.0.0} STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Sequence : sequenceBEsample not found
[2024-12-11 11:58:43,680] ERROR - ContinuationStackManager Sequence : sequenceBEsample not found
[2024-12-11 11:58:43,681] INFO - LogMediator {api:seqBEScenario:v1.0.0} STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Sequence : sequenceBEsample not found
[2024-12-11 11:58:43,686] WARN - Axis2Sender Trying to send a response to an already responded client request - Rest API Context : /seqbescenario/1.0.0
[2024-12-11 11:58:43,687] WARN - Axis2Sender Trying to send a response to an already responded client request - Rest API Context : /seqbescenario/1.0.0

<sequence xmlns="http://ws.apache.org/ns/synapse" name="sequenceBEsample">
     <log level="full">
                <property name="Start" value="Aggregate API Calls Sequence Started" />
            </log>

            <clone continueParent="true" id="externalServiceClone">
                <target>
                    <sequence>
                        <call>
                            <endpoint>
                                <http method="GET"
                                    uri-template="https://run.mocky.io/v3/e29a71fb-0dbc-48bf-b620-450c048cd5a0" />
                            </endpoint>
                        </call>
                    </sequence>
                </target>
                <target>
                    <sequence>
                        <call>
                            <endpoint>
                                <http method="GET"
                                    uri-template="https://run.mocky.io/v3/234fecd6-9e6e-43c0-8e5a-a7516b218be7" />
                            </endpoint>
                        </call>
                    </sequence>
                </target>
            </clone>

            <log level="full">
                <property name="Start" value="Aggregate API Calls Sequence Started #1" />
            </log>
            <aggregate id="externalServiceClone">
                  <completeCondition>
                    <messageCount max="-1" min="-1" />
                </completeCondition>
                <onComplete aggregateElementType="root" expression="json-eval($.)">
                    <log level="full">
                        <property name="Start" value="responding API Calls Sequence Started #2" />
                    </log>
                    <respond />
                </onComplete>
            </aggregate>
</sequence>

@BLasan
Copy link

BLasan commented Dec 17, 2024

Hi,

I tried applying the same sequence using the Sequence Backend endpoint and API Policy. When uploading the sequence as it self (with the tag <sequence xmlns="http://ws.apache.org/ns/synapse" name="sequenceBEsample">), it searches for the given sequence name as the content is embedded to the sequence file generated by the backend. This sequence file consists of a sequence inside a sequence. Hence, it outputs an error. Also, I tried applying only the content inside the sequence tag as a sequence backend and an api policy and it logs the following message on the console.

2024-12-17 11:36:17,762]  INFO - LogMediator {api:Test:v1} To: /test/1, MessageID: urn:uuid:022d41ef-3c24-4c3a-9b18-c0c4222e79e6, correlation_id: 022d41ef-3c24-4c3a-9b18-c0c4222e79e6, Direction: request, Start = Aggregate API Calls Sequence Started, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope>
[2024-12-17 11:36:17,768]  INFO - LogMediator {api:Test:v1} To: /test/1, MessageID: urn:uuid:022d41ef-3c24-4c3a-9b18-c0c4222e79e6, correlation_id: 022d41ef-3c24-4c3a-9b18-c0c4222e79e6, Direction: request, Start = Aggregate API Calls Sequence Started #1, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope>
[2024-12-17 11:36:17,775]  INFO - TimeoutHandler This engine will expire all callbacks after GLOBAL_TIMEOUT: 120 seconds, irrespective of the timeout action, after the specified or optional timeout
[2024-12-17 11:36:18,660]  INFO - LogMediator {api:Test:v1} To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:0b502d1a-8d46-4484-808f-43bf3d06088c, correlation_id: 022d41ef-3c24-4c3a-9b18-c0c4222e79e6_63feff97-8eee-45e0-807f-de8bf97ddcd7, Direction: request, Start = Aggregate API Calls Sequence Started #1, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>
[2024-12-17 11:36:18,691]  INFO - LogMediator {api:Test:v1} To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:dde33a8d-f2ed-4ade-a8a7-3aabc2fc8451, correlation_id: 022d41ef-3c24-4c3a-9b18-c0c4222e79e6_df999732-e709-40e2-ae40-48e93f5a9791, Direction: request, Start = Aggregate API Calls Sequence Started #1, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>
[2024-12-17 11:36:18,713]  INFO - LogMediator {api:Test:v1} To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:33df5d15-1278-46e8-9393-4aad3112776a, correlation_id: 022d41ef-3c24-4c3a-9b18-c0c4222e79e6_63feff97-8eee-45e0-807f-de8bf97ddcd7_64a895dc-93ba-48ca-9c92-17f4d4080edc, Direction: request, Start = responding API Calls Sequence Started #2, Payload: [null,null]
[2024-12-17 11:36:18,713]  WARN - Axis2Sender Trying to send a response to an already responded client request - Rest API Context : /test/1

Currently, we have followed the same approach as in the API/Operation policies and this can be currently considered as a limitation. However, this needs to be properly fixed in both scenarios when generating the sequence files which are getting stored under the sequence directory.

Thanks & Regards,
Benura

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants