Reputation: 71
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?
Upvotes: 2
Views: 1273
Reputation: 967
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
Upvotes: 0
Reputation: 889
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.
Upvotes: 0
Reputation: 51
In wso2esb4.8.1 Dynamically change our vfs endpoint.
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.
Upvotes: 1
Reputation: 5946
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 :
An other solution would be to use a scheduled task :
Upvotes: 0