Question

We are using several proxies that are listening to different locations. But during develpment, we aren't having the same URI as in the production environment. Is it possible to have the URI (transport.vfs.File.URI) external defined? (Maybe local-entry or another property?)

Following line should be able to load external definition of the actual URI:

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

Full Proxy Example (not working):

<proxy xmlns="http://ws.apache.org/ns/synapse" name="getRN100xml"
statistics="disable" trace="disable" transports="vfs">
<target>
    <inSequence>
   <send>...</send>
    </inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.MoveAfterProcess">C:/WSO2/In/saved</parameter>
<parameter name="transport.vfs.FileURI">get-property('myURI')</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.MoveTimestampFormat">yyMMddHHmmss</parameter>

Was it helpful?

Solution

You can check out this post WSO2 ESB - Dynamic value for proxy parameters (transport) for an example how to dynamically set values in a proxy sequence.

OTHER TIPS

A simple way to do this is to make a sequence template and set your parameters in that template. You read this template as the first action in your inSequence. Your proxy definition looks like:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="getRN100xml"
statistics="disable" trace="disable" transports="vfs">
<target>
 <inSequence>
   <call-template target="transport_vfs_parameter_settings"/>
 <send>...</send>
/<inSequence>
</target>

The template difinition looks sg. like:

<template xmlns="http://ws.apache.org/ns/synapse" name="transport_vfs_parameter_settings">
   <sequence>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.FileNamePattern" expression="test.xml"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.PollInterval" expression="15" scope="transport"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ActionAfterProcess" expression="MOVE" scope="transport"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.FileURI" expression="//localhost/D:/Test/in" scope="transport"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.MoveAfterProcess" expression="//localhost/D:/Test/processed" scope="transport"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.MoveAfterFailure" expression="//localhost/D:/Test/failure" scope="transport"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ContentType" expression="text/xml" scope="transport"></property>
    <property xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ActionAfterFailure" expression="MOVE" scope="transport"></property>
   </sequence>
</template>

In this way transporting your proxy definition to another environment means using a different template. Naturally, you can only set in the inSequence those parameters, whose values can be determined at the beginning of the inSequence. For example, if you want the replyFilename contain the reply messageID, set it in the outSequence.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top