You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Lorenzo Bolzani <l....@gmail.com> on 2010/06/10 17:13:52 UTC

How to best organize components and deployment

Hi,
I'm starting to use Servicemix and I'm not sure about how to best organize
the components.

The scenario I need to implement is something like this

1. poll a folder for an xml file
2. read the xml file, this contains an attribute pointing to a pdf file.
Read this too
3. call an already existing servicemix service to save this documents
4. send both the files to an external web service

If useful, as much as possible of the process should be defined as bpel with
ode.

Some parts are quite easy: I need a file:poller, I need a cxfbc:consumer and
a SU with the bpel definition.

But how many other SU should I define? Is it a good idea to place the poller
and the consumer in the same xbeans file? Or is better to keep them
separated?

Is it ok to add everything to a single SA or are there better options?

Ode is "required" to be able to monitor the process instance: do you think
it is a correct approach in this case or not?


Thanks, bye

Lorenzo

Re: How to best organize components and deployment

Posted by Lorenzo Bolzani <l....@gmail.com>.
Hi JB, thanks for your reply.

First of all, your needs look like the servicemix pdfcomposer that I'm
> creating currently. The PDF composer could take XML data, populate a PDF
> template with XML data (xpath or marshaler) to generate a new PDF doc.
> I plan to complete this new component is around two weeks.
>

In this specific case the pdf is already populated but the one your describe
could easily be a future scenario. I'll check it when available even if we
are working on the 3.2.3 version.


> Anyway, in your case, you need:
> 1/ a servicemix-file poller endpoint to read XML files (and send XML
> messages in the NMR).
> 2/ you can create your own bean to get incoming XML files and make your
> business. This bean can be exposed in ServiceMix using servicemix-bean
> component.
> 3/ If you want to send the data directly, your bean can send to a
> targetService/targetEndpoint. This targetEndpoint could be a HTTP provider
> endpoint (or CXF-BC provider endpoint).
> If you want to send data as attachment, I think that you need to implement
> the WebService call directly in your bean (using CXF for example).
>

Calling the WS in the bean looks like something hardcoded this is why I do
no feel sure about it. I could implement this writing only one component or
I could write two: the first one reading the file and creating the document
on the relational db followed by another looking up again the document from
the db and invoking the final WS. Maybe this last step could be again split
in two components.

At first I would expect the fewer components the better (less config, files,
etc.) but this means to hardcode more things. Is it just a trade off between
configuration complexity vs configurability? Are there any simple guidelines
to choose one option over the other? Even articles, books o sample apps
where this is discussed could be useful.


If you use JBI packaging, it's not possible to place the poller and consumer
> in the same XBean as it's based on two different components. So you need one
> SU based on servicemix-file component (with one xbean.xml) and one SU based
> on servicemix-http/servicemix-cxf-bc component (with one xbean.xml) and
> assemble both in a SA.
>

I missed this point. To me this is a big issue that leads to many micro
maven project with dependencies difficult to see.



> To be honest, I can't really see the advantage of using ODE in your case.
> What workflow/business logic you want to implement with BPEL/ODE ?
>
>
This is a three step process, single flow so there is not much to
coordinate. I expect there could be two reasons for using ODE:

1. to be able to see if the flow it's still running, on which step it's
waiting and so on using ode API. I never did this but I was told there is a
part of our codebase to do this.
2. to describe the whole flow in a single location instead of having it
fragmented in several xbeans files.

As I told I'm new to smix so maybe this is not correct.


Bye

Lorenzo

Re: How to best organize components and deployment

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Lorenzo,

First of all, your needs look like the servicemix pdfcomposer that I'm 
creating currently. The PDF composer could take XML data, populate a PDF 
template with XML data (xpath or marshaler) to generate a new PDF doc.
I plan to complete this new component is around two weeks.

Anyway, in your case, you need:
1/ a servicemix-file poller endpoint to read XML files (and send XML 
messages in the NMR).
2/ you can create your own bean to get incoming XML files and make your 
business. This bean can be exposed in ServiceMix using servicemix-bean 
component.
3/ If you want to send the data directly, your bean can send to a 
targetService/targetEndpoint. This targetEndpoint could be a HTTP 
provider endpoint (or CXF-BC provider endpoint).
If you want to send data as attachment, I think that you need to 
implement the WebService call directly in your bean (using CXF for example).

If you use JBI packaging, it's not possible to place the poller and 
consumer in the same XBean as it's based on two different components. So 
you need one SU based on servicemix-file component (with one xbean.xml) 
and one SU based on servicemix-http/servicemix-cxf-bc component (with 
one xbean.xml) and assemble both in a SA.

If you use SMX4, you can store all endpoints definition in a config.xml 
file that you put in the deploy directory.

You can package all SUs in one SA, the SA is really only an assembly 
artifact.

To be honest, I can't really see the advantage of using ODE in your 
case. What workflow/business logic you want to implement with BPEL/ODE ?

Regards
JB

On 06/10/2010 05:13 PM, Lorenzo Bolzani wrote:
> Hi,
> I'm starting to use Servicemix and I'm not sure about how to best organize
> the components.
>
> The scenario I need to implement is something like this
>
> 1. poll a folder for an xml file
> 2. read the xml file, this contains an attribute pointing to a pdf file.
> Read this too
> 3. call an already existing servicemix service to save this documents
> 4. send both the files to an external web service
>
> If useful, as much as possible of the process should be defined as bpel with
> ode.
>
> Some parts are quite easy: I need a file:poller, I need a cxfbc:consumer and
> a SU with the bpel definition.
>
> But how many other SU should I define? Is it a good idea to place the poller
> and the consumer in the same xbeans file? Or is better to keep them
> separated?
>
> Is it ok to add everything to a single SA or are there better options?
>
> Ode is "required" to be able to monitor the process instance: do you think
> it is a correct approach in this case or not?
>
>
> Thanks, bye
>
> Lorenzo
>