You may want to have a look at the MimeMailMarshaler and maybe extend it to suit your specific needs.
On 10/18/06, mart <[EMAIL PROTECTED]> wrote:
FTP works well with VFS and binaryFileMarshaler. I extended the marshaller to add a property (String) I use to route thanks to Drools component. I had to add lots of libraries (drools, janino -had to find the good version because the class EvaluationBase was lacking in current versions-, and antr), I do not know what they are useful fo but I had NoClassDefException. Routing does work great. Now my problem is to find how to convey the message to mail component since it is binary(+custom), the default mail marshaler doesn't handle it. gnodet wrote: > > On 10/17/06, mart <[EMAIL PROTECTED]> wrote: >> >> Ok so if I understood well (sorry if I sound stupid): >> >> API: you use the client API to write new component. > > The Client API (http://servicemix.goopen.org/site/client-api.html) > is usually only needed for specific use cases. If you implement > a lightweight component, you should inherit the ComponentSupport > class which has some helper methods too. You can also use > the client API if you want by creating a ServiceMixClientFacade > and pass the component's context to the constructor. > ServiceMixClient client = new ServiceMixClientFacade(getContext()); > >> >> FTP: some bugs in there > > There may be some bugs, yes. Some have already been reported, but > if users have fixes for them, it would be great to submit patches. > >> >> But I had no answer about these: http://servicemix.org/site/ftp.html >> >> >> mart wrote: >> > >> > And when you write : >> > " >> > >> > InOnly exchange = client.createInOnlyExchange(); >> > NormalizedMessage message = exchange.getInMessage(); >> > >> > message.setContent(new StringSource("<hello>world!</hello>")); >> > >> > client.sendSync(exchange); >> > >> > will generate an XML text file on the FTP server. Here is an example of >> > the FTP configuration on the server side. >> > >> > [...] >> > >> > " >> > >> > I am really discovering servicemix. >> > >> > >> > >> >> moraleslos wrote: >> > >> > Hi Mart, >> > >> > I've been working on the FTP component for the past week and I can tell >> > you my experiences. When using the FTPPoller, I did not see any >> downloads >> > happening. I can see the FTPPoller connecting appropriately but not >> > downloading. It turns out that the FTP Server was stalling on the >> > "client.completePendingCommand()" call before the input stream was >> closed. >> > I had to extend the FTPPoller class and override the processFile() >> method >> > to make this work. As for the FTPPoller downloading again and again, >> > you'll need to cache the files that it pulls so that it doesn't repeat >> > itself. I've put an issue on JIRA-- >> > http://issues.apache.org/activemq/browse/SM-704 -- for these. >> Hopefully >> > your problem is related to the above so that you can continue on. >> > >> > As for the Client API, it was built to make it easier to work with the >> JBI >> > container (no need to implement those component lifecycle interfaces >> and >> > such). Check out this link: >> > http://goopen.org/confluence/display/SM/POJO+support >> > >> > I've posted a couple of questions about this too: >> > >> http://www.nabble.com/ServiceMixClient-configuration-help-tf2440104.html >> > >> > Turns out I just extended ComponentSupport since I realized that when I >> > implemented MessageExchangeListener, this was also tied to ServiceMix's >> > API... thus I figured just to extend ComponentSupport which made my >> client >> > API easier to use. >> > >> > HTH, >> > >> > -los >> > >> > >> > mart wrote: >> >> >> >> Thanks; You say that binary message are handled directly with FTP BC. >> I >> >> put a 600k XLS file in my FTP folder and it just stops downloading >> after >> >> 13,8%. It starts another download again and again every time it polls >> the >> >> FTP. (Even if the download wouldn't stop, it is quite a problem that >> it >> >> starts another one). I do not know if it is because it is binary or >> >> because of the size. >> >> >> >> Another question: what the client API might be used for? What if I >> want >> >> to create a message, with a binary attachments, and info from this >> binary >> >> that I could handle afterwards to route inside the bus? >> >> >> >> And when you write : >> >> " >> >> >> >> InOnly exchange = client.createInOnlyExchange(); >> >> NormalizedMessage message = exchange.getInMessage(); >> >> >> >> message.setContent(new StringSource("<hello>world!</hello>")); >> >> >> >> client.sendSync(exchange); >> >> >> >> will generate an XML text file on the FTP server. Here is an example >> of >> >> the FTP configuration on the server side. >> >> >> >> [...] >> >> >> >> " >> >> >> >> what file/part this Java Code refers to? >> >> Thank you >> >> >> >> Martin >> >> >> >> gnodet wrote: >> >>> >> >>> Binary data should be conveyed as attachments on the >> >>> NormalizedMessage. Such attachments are handled by >> >>> BCs that support MIME requests (servicemix-http, servicemix-jms) >> >>> or other BCs supporting direct binary contents (using a binary file >> >>> marshaler for file, ftp ...). >> >>> See >> >>> >> http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/file/binary-example.xml >> >>> for an example. >> >>> >> >>> On 10/16/06, mart <[EMAIL PROTECTED]> wrote: >> >>>> >> >>>> Hello >> >>>> >> >>>> How and where to use the binaryfileMarshaler (or any marshaler I >> would >> >>>> program if this one doesn't make sense?)? >> >>>> >> >>>> I want to transport binary files through the bus. On an architecture >> >>>> point >> >>>> of view, what component/part do I need to code and what is the >> >>>> appropriate >> >>>> scenario to handle this? (like FTP => FTP or Mail(attachment) flow) >> ? >> >>>> >> >>>> Thanks for your answer >> >>>> -- >> >>>> View this message in context: >> >>>> http://www.nabble.com/Binary-file-transport-tf2452407.html#a6834968 >> >>>> Sent from the ServiceMix - User mailing list archive at Nabble.com. >> >>>> >> >>>> >> >>> >> >>> >> >>> -- >> >>> Cheers, >> >>> Guillaume Nodet >> >>> >> >>> >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Binary-file-transport-tf2452407.html#a6850240 >> Sent from the ServiceMix - User mailing list archive at Nabble.com. >> >> > > > -- > Cheers, > Guillaume Nodet > > -- View this message in context: http://www.nabble.com/Binary-file-transport-tf2452407.html#a6875706 Sent from the ServiceMix - User mailing list archive at Nabble.com.
-- Cheers, Guillaume Nodet
