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

Add Scatter Gather mediator #2231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SanojPunchihewa
Copy link
Contributor

@SanojPunchihewa SanojPunchihewa commented Nov 6, 2024

Purpose

Add new mediator to clone the messages and aggregate the results.

Syntax

<scatter-gather parallel-execution=(true | false)>
    <aggregation value="expression" condition="expression" timeout="long"
    min-messages="expression" max-messages="expression"/>
    <target>
        <sequence>
        (mediator)+
        </sequence>
    </target>+
</scatter-gather>

Sample configuration

<scatter-gather parallel-execution="true">
    <aggregation value="json-eval($)"/>
        <sequence>
            <payloadFactory media-type="json" template-type="default">
                <format>{
                    "pet": {
                        "name": "pet1",
                        "type": "dog"
                    },
                    "status": "success"
                    }</format>
                <args>
                </args>
            </payloadFactory>
            <log category="INFO" level="custom">
                <property name="Message" value="==== DONE scatter target 1 ===="/>
            </log>
        </sequence>
        <sequence>
            <call>
                <endpoint>
                    <http method="get" uri-template="http://localhost:5454/api/pet2"/>
                </endpoint>
            </call>
            <log category="INFO" level="custom">
                <property name="Message" value="==== DONE scatter target 2 ===="/>
            </log>
        </sequence>
</scatter-gather>

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

Successfully merging this pull request may close these issues.

1 participant