Hi,

I've managed to create some unique files with the following configs:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"; name="splitMessageProxy"
transports="http" startOnLoad="true" trace="disable">
    <target faultSequence="fault">
        <inSequence>
            <property name="FORCE_SC_ACCEPTED" value="true"
scope="axis2"/>
            <property name="OUT_ONLY" value="true" scope="default"/>
            <iterate
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
expression="//dieren/huisdier">
                <target
sequence="conf:/repository/synapse/default/sequences/splitter"/>
            </iterate>
        </inSequence>
    </target>
</proxy>

and my sequence:

<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse"; name="splitter">
    <property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";
xmlns:ns3="http://org.apache.synapse/xsd";
name="transport.vfs.ReplyFileName"
expression="fn:concat(fn:substring-after(get-property('MessageID'),'urn:
uuid:'), '.xml')" scope="transport"/>
    <send>
        <endpoint
key="conf:/repository/synapse/default/endpoints/fileshareEndpointNDV"/>
    </send>
    <description/>
</sequence>


Thanks for the tips !

-----Original Message-----
From: Hiranya Jayathilaka [mailto:[email protected]] 
Sent: dinsdag 2 augustus 2011 20:19
To: [email protected]
Subject: Re: How to generate unique file name ?

Perhaps we should support an XPath function for generating a uuid.

Thanks,
Hiranya

On Tue, Aug 2, 2011 at 9:09 PM, Jaeger, Jay - DOT
<[email protected]>wrote:

> It looks like they were already including the SYSTEM_DATE in the name,
per
> the original note.  In my experience, using a datestamp is not
sufficient to
> be unique in these kinds of cases, unless the volume is exceedingly
low.
>  Instead, you need something like a request number to go with, or a
process
> to check for the existence of the file ahead of time or after an
exception
> creating it.
>
> Jay Jaeger
> Wisconsin DOT
>
> -----Original Message-----
> From: Ruwan Linton [mailto:[email protected]]
> Sent: Tuesday, August 02, 2011 10:33 AM
> To: [email protected]
> Subject: Re: How to generate unique file name ?
>
> Try using the following snippet as the iterate target;
>
> <target>
>    <sequence>
>        <header name="To" action="set"
>
>
expression="fn:concat('file:',fn:concat(get-property('SYSTEM_DATE','yyMM
ddHHmmssSSS'),'_response.xml'))"/>
>        <send/>
>    </sequence>
> </target>
>
> Note that I have removed the endpoint from the target and added a send
to
> the sequence. You might want to prefix the directory path where you
want to
> save the splitted files too, in which case add that path after the
'file:'
> part of the first concat xpath expression.
>
> I hope this will be of some help for you :-)
>
> Ruwan
>
>
> On Tue, Aug 2, 2011 at 7:15 PM, De Vleeschauwer Nele <
> [email protected]> wrote:
>
> > I've just created a proxy service which receives a given xml files,
> > splits it and writes the different parts to disk. For each part, a
> > unique file name should be created:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <proxy xmlns="http://ws.apache.org/ns/synapse";
name="splitMessageProxy"
> > transports="http" startOnLoad="true" trace="disable">
> >    <target faultSequence="fault">
> >        <inSequence>
> >            <property name="FORCE_SC_ACCEPTED" value="true"
> > scope="axis2"/>
> >            <property name="OUT_ONLY" value="true" scope="default"/>
> >            <iterate
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> > expression="//dieren/huisdier">
> >                <target
> >
endpoint="conf:/repository/synapse/default/endpoints/fileshareEndpointND
> > V">
> >                    <sequence>
> >                        <property name="transport.vfs.ReplyFileName"
> >
expression="fn:concat(get-property('SYSTEM_DATE','yyMMddHHmmssSSS'),&quo
> > t;_response.xml&quot;)" scope="transport"/>
> >                    </sequence>
> >                </target>
> >            </iterate>
> >        </inSequence>
> >    </target>
> > </proxy>
> >
> > Apparently the splitting works fine, but the generated file names
are
> > never unique. Is there somewhere a property or something else
available
> > which can be used to generate a unique filename (instead of the
default
> > response.xml) ?
> >
> >
> >
> >
> >
> > -----------------------------------------
> > Visit our website! http://www.nbb.be
> >
> > "DISCLAIMER: The content of this e-mail message should not be
> > construed as binding on the part of the National Bank of Belgium
> > (NBB) unless otherwise and previously stated. The opinions
> > expressed in this message are solely those of the author and do not
> > necessarily reflect NBB viewpoints, particularly when the content
> > of this message, or part thereof, is private by nature or does not
> > fall within the professional scope of its author."
>
>
>
>
> --
> Ruwan Linton
> Member, Apache Software Foundation; http://www.apache.org
> <http://wso2.org>
>
> phone: +94 11 282 7532
> email: [email protected]; cell: +94 77 341 3097
> blog: http://blog.ruwan.org
> linkedin: http://www.linkedin.com/in/ruwanlinton
> google: http://www.google.com/profiles/ruwan.linton
> tweet: http://twitter.com/ruwanlinton
>



-- 
Hiranya Jayathilaka
Associate Technical Lead;
WSO2 Inc.;  http://wso2.org
E-mail: [email protected];  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Reply via email to