The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

vmaier (25) [Avatar] Offline
#1
Does anybody have a sample of using Flatpack in ServiceMix? Or point me to a place that has such a thing?
I'm trying to process some txt files and it seems to me that is the only option I have.

TIA

Valentin.
tijs.rademakers (494) [Avatar] Offline
#2
Re: Using Flatpack in ServiceMix
Hi,

Although there seems to be some work being done in ServiceMix 4 for offering FlatPack as an OSGi bundle, currently ServiceMix 3 does not support Flatpack out-of-the-box. If you want to process txt files, the typical solution within ServiceMix 3 is to use the File JBI component and implement a marshaler to convert the incoming text to an JBI XML message.
The default file marshaler is the org.apache.servicemix.components.util.FileMarshaler, but you can implement your own version very easily. Let me know if you need more info.

Best regards,

Tijs
vmaier (25) [Avatar] Offline
#3
Re: Using Flatpack in ServiceMix
Tijs,

I am new to Mule and Service Mix but I like the concept and I would like to adopt one of these technologies in our company. I'm not wed to anyone of these or any of their versions. I work for a Wall Street financial company and in this area most of the input is in delimited format or Excel.
So, with that in mind, what would you recommend? Mule or ServiceMix, and what additional packages? I certainly want to minimize the amount of code my team has to be doing.

TIA,

Valentin.
tijs.rademakers (494) [Avatar] Offline
#4
Re: Using Flatpack in ServiceMix
Valentin,

Will you use Java objects, XML messages or just the CSV or Excel files as payload for your message inside Mule or ServiceMix? I assume you will transform the CSV or Excel files to XML or to Java objects, right?
Well, the advantage of Mule is that with MuleForge there is a substantial set of projects available that will provide a good start for you. And if you are using Java objects for the message payload, Mule is your choice. If you want to standardize on JBI, need hot deployment and will use XML messages, I would go for ServiceMix. You can easily write a file marshaler that will transform a CSV message to a XML formatted message. Even with Excel files there are good frameworks that you can use to implement your file marshaler.

Best regards,

Tijs
vmaier (25) [Avatar] Offline
#5
Re: Using Flatpack in ServiceMix
Tijs,

Is there a place a can take a look for how to implement my own file marshaler?

Thanks,

Valentin.
tijs.rademakers (494) [Avatar] Offline
#6
Re: Using Flatpack in ServiceMix
hi valentin,

In our book we show a jms marshaler on page 341. This is very similar to a file marshaler. Let me know if you need more info.

Best regards,

Tijs
vmaier (25) [Avatar] Offline
#7
Re: Using Flatpack in ServiceMix
Yeah, it would be nice if I could get more info.

I can't quite relate the JMS example to a file since the signature of the 2 marshalers is quite different. I would be all set if I could find the implementation of BinaryFileMarshaler or SimpleFileMarsaler. But I could not find these 2 classes not even I downloaded the source code of ServiceMix.

Do you know where I can find these?

Thanks,

Valentin.
vmaier (25) [Avatar] Offline
#8
Re: Using Flatpack in ServiceMix
OK Tijs,

I finally found the source code here: http://www.java2s.com/Open-Source/Java-Document/ESB/servicemix/org/apache/servicemix/components/util/SimpleFlatFileMarshaler.java.htm and now I should be all set.

But my question to you is: why can I not find it with the downloaded source code from Service Mix?

Thanks,

Valentin.
tijs.rademakers (494) [Avatar] Offline
#9
Re: Using Flatpack in ServiceMix
Hi Valentin,

You can find the SimpleFlatFileMarshaler and the DefaultFileMarshaler source code in the following directory of the ServiceMix 3.2.1 source code distribution:

apache-servicemix-3.2.1srccoreservicemix-coresrcmainjavaorgapacheservicemixcomponentsutil

Best regards,

Tijs