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

Connector config is hidden when having inside switch mediator #493

Open
arunans23 opened this issue Nov 1, 2024 · 0 comments
Open

Connector config is hidden when having inside switch mediator #493

arunans23 opened this issue Nov 1, 2024 · 0 comments

Comments

@arunans23
Copy link
Member

Description

When we have two branches for a switch mediator and both have a connector operation, one config operations get hidden inside the other branch.

Screenshot 2024-11-01 at 08 18 17

Steps to Reproduce

Sample API

<api xmlns="http://ws.apache.org/ns/synapse" name="WeatherDataAPI" context="/weather">
    <resource methods="GET" uri-template="/data?city={city}">
        <inSequence>
            <property name="uri.var.city" expression="$url:city"/>
            <call>
                <endpoint>
                    <http url="http://api.openweathermap.org/data/2.5/weather?q={uri.var.city}&amp;appid=your_api_key_here" method="GET"/>
                </endpoint>
            </call>
            <switch source="get-property('axis2', 'HTTP_SC')">
                <case regex="200">
                    <property name="weatherData" expression="json-eval($body)" scope="default" type="STRING"/>
                    <email.send configKey="EmailConnectorConfig">
                        <from>[email protected]</from>
                        <to>[email protected]</to>
                        <subject>Weather Update</subject>
                        <content type="text/plain">Weather data for {uri.var.city}: Temperature - {json-eval($.main.temp)}°C</content>
                    </email.send>
                    <payloadFactory media-type="json">
                        <format>{"message": "Email sent successfully"}</format>
                        <args/>
                    </payloadFactory>
                    <respond/>
                </case>
                <default>
                    <property name="fileName" expression="fn:concat('weatherData_', get-property('SYSTEM_TIME'), '.txt')" scope="default" type="STRING"/>
                    <file.write configKey="FileConnectorConfig" path="{get-property('fileName')}">
                        <content>{$ctx:weatherData}</content>
                    </file.write>
                    <payloadFactory media-type="json">
                        <format>{"message": "Failed to send email, data stored in file", "fileName": "$1"}</format>
                        <args>
                            <arg evaluator="xml" expression="get-property('fileName')"/>
                        </args>
                    </payloadFactory>
                    <respond/>
                </default>
            </switch>
        </inSequence>
        <faultSequence>
            <log level="custom">
                <property name="ERROR" value="An error occurred"/>
            </log>
            <respond/>
        </faultSequence>
    </resource>
</api>

Version

1.1.2

Environment Details (with versions)

No response

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

1 participant