WSO2 ESB - Dynamic value for proxy parameters (tra

2019-06-27 09:23发布

I need to be able to specify a dynamic value for proxy parameter. Actually, I have to specify each parameter with complete URL like :

<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>

I see some samples with property mediator and I guess it's working for next proxies but the problem here is that I need to change the proxy parameters value before its execution I think. I tried with a "trigger" proxy calling a custom mediator which change SynapseConfiguration of required proxy but this wasn't working.

Is there a way to replace these fixed value with lookups to create some deployment configuration ?

Many thanks.

2条回答
The star\"
2楼-- · 2019-06-27 09:46

You can check out this post How to dynamically route message in WSO2 ESB based on XML configuration file for an example how to dynamically set values in a proxy sequence.

You can do something this:

<parameter name="transport.vfs.FileNamePattern">
    <script language="js">mc.getProperty('MY_DYNAMIC_VALUE')</script>
</parameter>

I am not sure this will help you much, as I suspect that the vfs parameters are set when initializing the proxy and not on the fly. If you give it a try, if possible please post back to this thread if it works or not.

Regards, nidkil

查看更多
我只想做你的唯一
3楼-- · 2019-06-27 09:58

The Parameters in the Proxy service definitions are service level Parameters which is in the Axis2Service Configuration . They are used when you are initialing the Axis2Service in this case its the Synapse/WSO2 ESB proxy service. So you can't change the parameters dynamically on the fly.

But i can suggest following approach. It might or might not applicable to your scenario.

Have set of VFS proxies that listen for separate locations. Each will look at a give file extension. (one for .txt one for .foo etc..)

Use another generic vfs proxy to copy files to correct places dynamically(which accepts any extension).(You can use vfs sender).

Hope this helps.

cheers, Charith

查看更多
登录 后发表回答