2

I have this parameter with a path file:

<parameter name="transport.vfs.FileURI">file:///Users/Desktop/test/in</parameter>

I need to change FileURI value dynamically, for example, using the value of a property that was set before. Something like that:

<parameter name="transport.vfs.FileURI">get-property('path')</parameter>

Or that:

<parameter name="transport.vfs.FileURI" expression="get-property('path')"/>

How can I change the FileURI value for a property value?

Community
  • 1
  • 1

4 Answers4

1

In wso2esb4.8.1 Dynamically change our vfs endpoint.

Dynamic Endpoint URL ref

Example: We are getting filename by Property mediator "fname".

<property name="fname" expression="get-property('transport','FILE_NAME')"/>

We are getting "Path" dynamically by property mediator.

<property name="path" value="file:///D:/FileFolder/In/"/> 

We are adding path and filename in "transport.vfs.ReplyFileName" property.

<property name="transport.vfs.ReplyFileName" expression="concat(get-property('path'),get-property('fname'))" scope="transport"/>

<send>
        <endpoint>
            <address uri="vfs:file:///D:/Folder/In"/>
        </endpoint>
</send>

"transport.vfs.ReplyFileName" will replace send mediator vfs endpoint.

We can achieve Dynamic Endpoint. we can move our file by Property mediator. We can change Property easily.

Navaneeth
  • 51
  • 4
0

As far as I know, with ESB 4.8.1, you can't change dynamically this parameter inside the mediation (this value is static).

Perhaps coul'd you try to dynamically change this proxy definition at runtime :

  • using admin services (ProxyServiceAdmin)
  • or in java or javascript (with mc.getConfiguration(), you can access to synapse config)

An other solution would be to use a scheduled task :

Jean-Michel
  • 5,926
  • 1
  • 13
  • 19
0

I believe the best approach is to store those values in database and load from a dataService, after that you can put and use them as properties.

LottaLava
  • 889
  • 1
  • 9
  • 21
0

We can achieve this by using combination of header mediator and default endpoint. PATH is atual path eg. (D:/Test/Image) FILENAME is actual file ( testImage.png)

**<property expression="concat('vfs:file:///',$ctx:PATH,'/',$ctx:FILENAME)" name="localpath" scope="default" type="STRING"/>
 <header expression="get-property('localpath')" name="To" scope="default"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
 <call/>**

The default endpoint will look for the endpoint url from “To” transport header. Therefore, the endpoint can be constructed dynamically and set to “To” header.

FYI, ClickHere

Justin
  • 855
  • 2
  • 11
  • 30