Hi All,
I have just started using/developing services for ServiceMix. The 'service'
I am developing is reading traffic speed/intensity data of around 20000
points (around 50 bytes per point every minute) from non-xml files and to
store this data in a database and then provide access to (part of) this
data.
I have worked through the tutorials on the ServiceMix site. So I have some
understanding how to do thing and what is possible, but I am still not fully
clear what is the right/ServiceMix way of doing something like this.
So far I have created 2 different solutions for the load-to-database part
(Essentially it's an ETL service, if I understand it correctly).
My first solution is:
First stage:
servicemix-file-poller (with a BinaryFileMarshaler) => servicemix-bean
(MessageExchangeListener) that creates 4 CSV-files from 1 input file.
And then a second stage:
servicemix-file-poller for the CSV-files (with a BinaryFileMarshaler) =>
servicemix-bean (MessageExchangeListener) that uses JDBC and MySQL specific
SQL to load the data into the database.
My second solution using Camel:
from("file:datadir").convertBodyTo(String.class).splitter(new
MySplitter()).to("myDataLoader");
Here MySplitter is an org.apache.camel.Expression that splits/transforms the
incoming String to the 4 CSV-strings which are then send to the myDataLoader
bean.
What are better solutions for this 'problem'?
I am also a bit confused about when and how to use Camel and when to use the
ServiceMix binding components / service engines. They seem to have a large
overlap, but are not fully interchangeable/compatible (for example: camel
has org.apache.camel.Exchange, ServiceMix has
javax.jbi.messaging.MessageExchange).
I would also like to be able to easily change the file poller to a ftp
poller. Ideally by selecting which service-unit I deploy. How can I do that?
--
Hans Bogaards