Yasothar
Yasothar

Reputation: 453

wso2 ESB calling Sequence Mediator in a chain

I have this following mediation flow in wso2 ESB for a client.

Sequence 1
    Call data service
    Check data availability
        if available
            Get data using data service
            Manipulate data using payload factory
            Iterate based on node
                send data to client
                get response
                create payload based on response to data service
                update database
            end iterate
        end if
    end

Similar to the sequence 1, I have sequence 2, sequence 3.. sequence n calling different data services and different client endpoints. Sequence 1 works correctly, fetching data and updating the database. When the flow goes to sequence 2, while logging, I can see the contents/messages from sequence 1 found in sequence 2 which causes the sequence 2 perform erroneously. My question is, is there a way to like a java flush(), close() from moving from sequence 1 to sequence 2 in the wso2 ESB.

Thanks in advance.

Upvotes: 0

Views: 1019

Answers (1)

Philipp
Philipp

Reputation: 4749

Solution 1: You can use the clone mediator to create multiple instances of your message content.

Solution 2: Another possibility is to store the initial content (before sequence1 starts) in a and update the initial content again before sequence2 start. Use the enrich mediator for this.

As the clone mediator is not recommended (creates new threads!), I would go for the second solution with the enrich mediator.

<!-- store the initial message content -->
<enrich> 
    <source type="body" clone="true"/>
    <target type="property" property="BodyBackup"/>
</enrich>

<sequence key="sequence1"/>

<!-- restore the message content -->
<enrich> 
    <source type="property" property="BodyBackup"/>
    <target type="body"/>
</enrich>

<sequence key="sequence2"/>

Upvotes: 1

Related Questions