Last active
December 24, 2024 11:44
-
-
Save chamilaadhi/2fcde09f6e07b1646a82366698c455c6 to your computer and use it in GitHub Desktop.
custom-backend.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <sequence name="custom-backend" xmlns="http://ws.apache.org/ns/synapse"> | |
| <property name="REST_URL_POSTFIX" value="" scope="axis2"/> | |
| <call blocking="true"> | |
| <endpoint name="JSONBackend" xmlns="http://ws.apache.org/ns/synapse"> | |
| <http method="get" uri-template="http://localhost:3010/bookings" /> | |
| </endpoint> | |
| </call> | |
| <property name="nexus_total" expression="json-eval($.bookings.total)" scope="default" type="STRING"/> | |
| <!-- Call WishqueEndpoint and extract the summary text --> | |
| <call blocking="true"> | |
| <endpoint name="XMLBackend" xmlns="http://ws.apache.org/ns/synapse"> | |
| <http method="get" uri-template="http://localhost:3011/metrics/summary" /> | |
| </endpoint> | |
| </call> | |
| <property name="wishque_total" expression="//total/text()" scope="default" type="STRING"/> | |
| <!-- Construct the final JSON response --> | |
| <payloadFactory media-type="json"> | |
| <format>{"bookings": {"nexus_total": "$1", "wishque_total": "$2"}}</format> | |
| <args> | |
| <arg evaluator="xml" expression="get-property('nexus_total')"/> | |
| <arg evaluator="xml" expression="get-property('wishque_total')"/> | |
| </args> | |
| </payloadFactory> | |
| </sequence> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment