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

Issue with Header Mediator in multi thread environment #5551

Open
sreenath-centime opened this issue Mar 22, 2022 · 0 comments
Open

Issue with Header Mediator in multi thread environment #5551

sreenath-centime opened this issue Mar 22, 2022 · 0 comments

Comments

@sreenath-centime
Copy link

Description:
Header Mediator is not working as expected in multi threaded environments.

I built a flow which will be invoked concurrently my many users. I am setting a property called 'clientId'( unique identifier for each user) in header mediator and also in the message context(say a payload factory).
In some rare scenario, I have observed that the clientId in header and payload factory are showing differently.
After debugging further, I noticed that clientId in header mediator is coming from a different thread ( thread2) and clientId in payload factory is set from current thread( thread1). Say the current thread is thread1.

After extracting logs from thread2, clientId in header and payload factory in thread2 are set correctly (with value of thread2)

sample code where the issue is observed

<payloadFactory description="gl-detail payload" media-type="json">
        <format>{ "clientId": $1, "sourceName": "$2","sourceId": "$3" }
		</format>
        <args>
            <arg evaluator="xml" expression="get-property('clientId')"/>
            <arg evaluator="xml" expression="get-property('sourceName')"/>
            <arg evaluator="xml" expression="get-property('sourceId')"/>
        </args>
    </payloadFactory>
    <header description="clientid" expression="get-property('clientId')" name="clientid" scope="transport"/>
    <call blocking="true">
        <endpoint key="gov:endpoints/UpdateSourceDetailEP.xml"/>
    </call>

Version : WSO2 Micro Integrator 1.2

This use case is causing issues for us as the critical client level information is getting swapped in our production environment.
I am referring to this link which says that header mediator is conditionally content aware and guessing this could be an issue.
https://ei.docs.wso2.com/en/latest/micro-integrator/references/mediators/header-Mediator/

I couldn't find much help online trying to understand this issue. Kindly help us to fix this problem at the earliest.

Thanks in advance.

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

No branches or pull requests

1 participant