Thanks for the help Gert. I thought I would just post the config I ended up with for anyone else reading this thread.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0" xmlns:bean="http://servicemix.apache.org/bean/1.0" xmlns:ck-prototype="http://test.co.uk/ck-prototype" > <ftp:sender service="ck-prototype:moveSender" endpoint="endpoint" uri="ftp://chris:t...@localhost/"> <ftp:marshaler> <bean class="org.apache.servicemix.components.util.DefaultFileMarshaler"> <property name="fileName"> <bean class="org.apache.servicemix.expression.JAXPStringXPathExpression"> <constructor-arg value="concat('ck-',/message/ID,'.xml')" /> </bean> </property> </bean> </ftp:marshaler> </ftp:sender> </beans> Gert Vanthienen wrote: > > Chris, > > You're using ServiceMix 3.3, right? I'm afraid we (or more > specifically, I did this myself ;) moved the defaultFileMarshaler into > a shared location, so it could be used by both the components and the > ServiceMix 3.3 container. We should have left a copy in the container > itself to make sure the schema gets generated. Could you open a JIRA > issue to get this fixed for ServiceMix 3.3.1? > > For now, as a workaround, you should be able to use plain Spring > configuration to replace the servicemix core elements: > <bean class="org.apache.servicemix.components.util.DefaultFileMarshaler"> > <property name="fileName"> > <bean > class="org.apache.servicemix.expression.JAXPStringXPathExpression"> > <property name="xpath" value="concat('test','.xml')"/> > </bean> > </property> > </bean> > > Regards, > > Gert Vanthienen > ------------------------ > Open Source SOA: http://fusesource.com > Blog: http://gertvanthienen.blogspot.com/ > > > > 2009/1/27 chriskee <[email protected]>: >> >> Gert, >> >> Thanks for the reply, this helps with the direction I need to go. I >> knocked >> together a quick test based on what you said but get a >> >> Unrecognized xbean element mapping: defaultFileMarshaler in namespace >> http://servicemix.apache.org/config/1.0 when deploying >> >> >> I have the following >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0" >> xmlns:bt-prototype="http://uk.co.lbi/bt-prototype" >> xmlns:sm="http://servicemix.apache.org/config/1.0" >> > >> >> <ftp:sender service="bt-prototype:moveSender" >> endpoint="endpoint" >> uri="ftp://chris:t...@localhost/"> >> <ftp:marshaler> >> <sm:defaultFileMarshaler> >> <sm:fileName> >> <sm:xpathString >> xpath="concat('test','.xml')"/> >> </sm:fileName> >> </sm:defaultFileMarshaler> >> </ftp:marshaler> >> </ftp:sender> >> >> >> </beans> >> >> >> Am I doing something stupid, missing something out or deploying wrongly. >> Again any help will be gratefully recieved >> >> Regards >> Chris >> >> >> >> Gert Vanthienen wrote: >>> >>> Chris, >>> >>> You can configure the file name on the FTP endpoint the same way as you >>> can with the servicemix-file component. If you look at the first >>> marshaler example on http://servicemix.apache.org/servicemix-file.html, >>> you can use the same thing for ftp (just use ftp:marshaler instead of >>> file:marshaler). >>> >>> The example uses a message property to determine the name, but you can >>> also use an XPath expresssion to look inside your XML message and grab >>> some information there to make up the file name. >>> >>> For the conversion to mail, are you using the servicemix-mail component >>> or the camel-mail one? For the servicemix-mail component, you can write >>> your own Marshaler class that allows you to 'translate' the JBI message >>> into a mail message. >>> >>> Regards, >>> >>> Gert >>> >>> chriskee wrote: >>>> I am currently learning how to use servicemix and not sure how I would >>>> achieve the following. >>>> >>>> I have a message placed on a JMS Queue and want to post a message to a >>>> defined email address than a message has been recieved. I also then >>>> want >>>> to >>>> ftp this message as a simple file. I am able to pull this message off >>>> the >>>> JMS queue and do things with it as long as all it is a XML message. >>>> The >>>> problem I have is when I want to convert to something else such as a >>>> email >>>> or a file to FTP. >>>> >>>> I had intended to write a JMS consumer and then pass to an EIP >>>> component >>>> which then delivered it to both the ftp and email components. When I >>>> try >>>> sending the message as ftp I get a >>>> >>>> java.io.IOException: No output stream available for output name: null. >>>> Maybe >>>> the file already exists? >>>> >>>> I assume this is because I never had a filename from the begining as I >>>> am >>>> working with a XML message rather than a file that's been read in. For >>>> example if I switch to a File poller and can then FTP fine. My >>>> question >>>> is >>>> what approach should I use to take a XML message from a queue convert >>>> it >>>> to >>>> a file to ftp and then also how to convert to send via email. >>>> >>>> Any help, no matter how small is gratefully recieved >>>> >>>> Thanks >>>> Chris >>>> >>> >>> >>> >>> ----- >>> --- >>> Gert Vanthienen >>> http://gertvanthienen.blogspot.com >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Approach-to-use-for-XML-to-FTP-and-XML-to-Email-tp21667383p21684695.html >> Sent from the ServiceMix - User mailing list archive at Nabble.com. >> >> > > > ----- > --- > Gert Vanthienen > http://gertvanthienen.blogspot.com > -- View this message in context: http://www.nabble.com/Approach-to-use-for-XML-to-FTP-and-XML-to-Email-tp21667383p21727073.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
