[esb-java-user] VFS and custom mediator

SEGUINOT Christophe christophe.seguinot-partner at arcelormittal.com
Fri Dec 19 00:14:49 PST 2008


Thanks Paul. 

-----Message d'origine-----
De : esb-java-user-bounces at wso2.org [mailto:esb-java-user-bounces at wso2.org] De la part de Paul Fremantle
Envoyé : jeudi 18 décembre 2008 18:01
À : esb-java-user at wso2.org
Objet : Re: [esb-java-user] VFS and custom mediator

Actually the PayloadHelper class is much better solution!

Paul

Ruwan Linton wrote:
> SEGUINOT Christophe wrote:
>> Thanks a lot,
>>
>> I have an other question if I can.
>>
>> I'm loading a file from the filesystem using vfs. This is a text file. I'm developping a custom mediator to convert this text file to an xml file and then I want to write the xml file to the filesystem again:
>>
>>   <syn:proxy name="ConvertMkppProxy" transports="vfs" startOnLoad="true">
>>         <syn:target inSequence="MyMediatorSequence" outSequence="MyMediatorSequence"/>
>>         <syn:parameter name="transport.vfs.ContentType">text/plain</syn:parameter>
>>         <syn:parameter name="transport.vfs.ActionAfterFailure">MOVE</syn:parameter>
>>         <syn:parameter name="transport.vfs.MoveAfterProcess">file://L:\wso2\xml</syn:parameter>
>>         <syn:parameter name="transport.vfs.MoveAfterFailure">file://L:\wso2\failure</syn:parameter>
>>         <syn:parameter name="transport.vfs.ActionAfterProcess">MOVE</syn:parameter>
>>         <syn:parameter name="transport.vfs.FileNamePattern">.*\.txt</syn:parameter>
>>         <syn:parameter name="transport.vfs.FileURI">file://L:\wso2\out</syn:parameter>
>>         <syn:parameter name="transport.PollInterval">15</syn:parameter>
>>     </syn:proxy>
>>
>>  <syn:sequence name="MyMediatorSequence">
>>         <syn:class name="samples.mediators.DiscountQuoteMediator"/>
>>         <syn:log level="full" separator=","/>
>>         <syn:send>
>>             <syn:endpoint>
>>                 <syn:address uri="vfs:file://L:\wso2\out-send-endpoint"/>
>>             </syn:endpoint>
>>         </syn:send>
>>     </syn:sequence>
>>
>> My Mediator :
>>
>> public class DiscountQuoteMediator
>>     extends AbstractMediator
>>     implements ManagedLifecycle
>> {
>>
>>
>>     public boolean mediate(final MessageContext mc)
>>     {
>>         Axis2MessageContext axis2MessageCtx = (Axis2MessageContext) mc;
>> 	//is empty
>>         System.out.println("axis2MessageCtx.getEnvelope().getBody().getText(): "
>>             + axis2MessageCtx.getEnvelope().getBody().getText());
>> 	//is empty
>>         System.out.println("-------------- mc.getEnvelope().getBody().getText() : "
>>             + mc.getEnvelope().getBody().getText() + "--------------");
>> 	//is empty
>>         System.out.println("-------------- mc.getEnvelope().getText() : "
>>             + mc.getEnvelope().getText() + "--------------");
>>
>>         return true;
>>     }
>> .......
>>   
> Try the following code fragment;
> 
> mc.getEnvelope().getBody().getFirstElement().getText();
> 
> Thanks,
> Ruwan
>> So I can't manipulate the content of the file loaded by vfs but this content is correctly written as a response.xml by the send mediator configured with a vfs endpoint. (the response.xml contains simply my text data).
>>
>> Do you know a way to manipulate the content of the file loaded by vfs in a mediator ?
>>
>> Thanks a lot.
>>
>> Christophe
>>
>>  
>>
>> -----Message d'origine-----
>> De : esb-java-user-bounces at wso2.org 
>> [mailto:esb-java-user-bounces at wso2.org] De la part de Ruwan Linton 
>> Envoyé : jeudi 18 décembre 2008 11:22 À : esb-java-user at wso2.org 
>> Objet : Re: [esb-java-user] JMS and VFS
>>
>> SEGUINOT Christophe wrote:
>>   
>>> Hi,
>>>
>>> Do you know if it's possible using WSO2/Synapse :
>>> To mobe the content (at a regular interval) from a folder to an 
>>> other folder, without invoking anything ? (I see Proxy + VFS 
>>> Transport)
>>>   
>>>     
>> You could use a task to accomplish this task. Basically you can schedule a task to poll a file from a given location and move it to the relevant location using the vfs transport and send mediator. Please have a look at the task sample [1] and the vfs samples [2].
>>   
>>> To communicate with WSO2/Synapse through JMS (but without web 
>>> service) and process the content of the JMS messages ? (I see it but 
>>> for a Web Service using JMS transport)
>>>   
>>>     
>> This can also be done, but what do you mean by without a web service? If you want to send a jms text message without involving SOAP, to synapse that is possible. Synapse JMS transport listens for a particular JMS queue configured by a proxy service. If you could elaborate on your exact requirement, I can provide you a descriptive answer.
>>
>> Thanks,
>> Ruwan
>>
>> [1] - 
>> http://wso2.org/project/esb/java/1.7.1/docs/ESB_Samples.html#Task
>> [2] - 
>> http://wso2.org/project/esb/java/1.7.1/docs/ESB_Samples.html#Sample25
>> 4
>>   
>>> Thanks for any clue.
>>>
>>> Christophe
>>>  
>>>
>>> -----Message d'origine-----
>>> De : esb-java-user-bounces at wso2.org 
>>> [mailto:esb-java-user-bounces at wso2.org] De la part de 
>>> esb-java-user-request at wso2.org Envoyé : jeudi 11 décembre 2008 11:01 
>>> À
>>> : SEGUINOT Christophe Objet : Welcome to the "Esb-java-user" mailing 
>>> list
>>>
>>> Welcome to the Esb-java-user at wso2.org mailing list!
>>>
>>> To post to this list, send your email to:
>>>
>>>   esb-java-user at wso2.org
>>>
>>> General information about the mailing list is at:
>>>
>>>   https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>>
>>> If you ever want to unsubscribe or change your options (eg, switch to or from digest mode, change your password, etc.), visit your subscription page at:
>>>
>>>   
>>> https://wso2.org/cgi-bin/mailman/options/esb-java-user/christophe.se
>>> gu
>>> inot-partner%40arcelormittal.com
>>>
>>>
>>> You can also make such adjustments via email by sending a message to:
>>>
>>>   Esb-java-user-request at wso2.org
>>>
>>> with the word `help' in the subject or body (don't include the quotes), and you will get back a message with instructions.
>>>
>>> You must know your password to change your options (including changing the password, itself) or to unsubscribe.  It is:
>>>
>>>   bopotemo
>>>
>>> Normally, Mailman will remind you of your wso2.org mailing list passwords once every month, although you can disable this if you prefer.  This reminder will also include instructions on how to unsubscribe or change your account options.  There is also a button on your options page that will email your current password to you.
>>>
>>> _______________________________________________
>>> Esb-java-user mailing list
>>> Esb-java-user at wso2.org
>>> https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>>
>>>   
>>>     
>>
>> _______________________________________________
>> Esb-java-user mailing list
>> Esb-java-user at wso2.org
>> https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>
>> _______________________________________________
>> Esb-java-user mailing list
>> Esb-java-user at wso2.org
>> https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>
>>   
> 
> 
> _______________________________________________
> Esb-java-user mailing list
> Esb-java-user at wso2.org
> https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
> 

--
Paul Fremantle
CTO and Co-Founder, WSO2
OASIS WS-RX TC Co-chair
VP, Apache Synapse

Office: +44 844 484 8143
Cell: +44 798 447 4618

blog: http://pzf.fremantle.org
paul at wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

_______________________________________________
Esb-java-user mailing list
Esb-java-user at wso2.org
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user



More information about the Esb-java-user mailing list