0

I am new to WSO2 and Apache Synapse..I make a proxy service to route some files to another folder, but when I look the JConsole, there is only 1 thread that working.

How can I configure the setting to make multiple threads working and process the same source folder at the same time??I configure the threadpool like this :

-Dsnd_t_core=3 \
-Dsnd_t_max=5000 \
-Dsnd_qlen=-1 \

And my proxy service look like this :

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
      <parameter name="cachableDuration">15000</parameter>
   </registry>
   <proxy name="Service1"
          transports="vfs"
          startOnLoad="true"
          trace="enable"
          statistics="enable">
      <description/>
      <target>
         <inSequence>
            <log level="custom">
               <property name="Message" value="Routing start"/>
               <property name="filename"
                         expression="fn:concat(get-property('transport', 'FILE_NAME'), '.xml')"/>
            </log>
         </inSequence>
         <outSequence>
            <property name="OUT_ONLY" value="true"/>
         </outSequence>
      </target>
      <parameter name="transport.vfs.Streaming">false</parameter>
      <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
      <parameter name="transport.PollInterval">1</parameter>
      <parameter name="transport.vfs.FileURI">file:///home/user/test/target2</parameter>
      <parameter name="transport.vfs.MoveAfterProcess">file:///home/user/test/target</parameter>
      <parameter name="transport.vfs.MoveAfterFailure">file:///home/user/test/failure</parameter>
      <parameter name="transport.vfs.Locking">disable</parameter>
      <parameter name="transport.vfs.FileNamePattern">.*.*</parameter>
      <parameter name="transport.vfs.ContentType">text/plain</parameter>
      <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
   </proxy>
   <sequence name="fault">
      <log>
         <property name="MESSAGE" value="Executing default &#34;fault&#34; sequence"/>
         <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
         <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
      </log>
      <drop/>
   </sequence>
   <sequence name="main">
      <in>
         <filter source="get-property('To')" regex="http://localhost:9000.*">
            <send/>
         </filter>
      </in>
      <out>
         <send/>
      </out>
      <description>The main sequence for the message mediation</description>
   </sequence>
</definitions>
Community
  • 1
  • 1
Mari_Yaguchi
  • 477
  • 8
  • 25

1 Answers1

1

As i understand from your issue what you are trying to do is serve same message parallel and store them in a file in parallel executions.

If So the way to achive this is to use the clone mediator.The clone mediator will split the message into number of identical messages which will be processed in parallel

You can refer clone mediator documentation by [1].

As per the your scenario you can use iterate mediator to iterate as per file names in your parant message samples on iterate mediator can be found at [2], And sample on [3]

[1]. http://docs.wso2.org/wiki/display/ESB460/Clone+Mediator

[2].http://docs.wso2.org/wiki/display/ESB460/Sample+400%3A+Message+Splitting+and+Aggregating+the+Responses

[3].http://docs.wso2.org/wiki/display/ESB460/Iterate+Mediator

Thank You, Dharshana.

Dharshana
  • 1,212
  • 1
  • 9
  • 18
  • Thanks for the answer. My condition is I have thousands of files in a folder and I want to route these files to another folder. But I found from the jConsole that only 1 vfs-worker process my service. How can I make the service to be processed by multiple threads? Can WSO2 support the using of ThreadPool? – Mari_Yaguchi Apr 16 '13 at 02:12
  • I have a similar situation and don't see how the answer above apples. Any more information on this use case would be helpful. – eptx Nov 20 '13 at 20:39