camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gert Vanthienen <gert.vanthie...@gmail.com>
Subject Re: [Advice] : Architectural design regarding to granularity of SOA
Date Mon, 15 Jun 2009 09:17:01 GMT
Charles,

There currently is no built-in way to preserve state.  We could
probably add that to Camel, using the exchange id as the correlation
identifier to figure out which data belongs to which Exchange.
However, wouldn't it be easier to put the validation result in a
header?  That way, the validation result could travel along with the
business object, but rather as metadata about the business object
instead of replacing it in the message body.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/6/15 Charles Moulliard <cmoulliard@gmail.com>:
> Hi,
>
> I' m confronted to the following "dilemma". The architecture of a product
> that I currently design uses Apache Camel 2.0 and Spring DSL. I have decided
> to use Spring DSL because I would benefit of the fact that routing can be
> modified in the XML file. Nevertheless, I' m confronted to the following
> issue who could be solved in different ways.
>
> This is why I ask point of view of Camel designer to have your advices !
>
> The routing calls different services to parse/validate/transform and save
> content of messages. These services have been designed as interface and
> classes implementing the interface. Spring is used to publish the services
> top of OSGI server (Apache Karaf). Here is the description of the routing :
>
>        <camel:route>
>            <!-- Create request message -->
>            <camel:from ref="directRequestMessageEndpoint" /> // direct
> endpoint
>
>            <!-- Split the collection of messages -->
>            <camel:split>
>                <camel:ognl>request.body</camel:ognl>
>
>                <!-- (1) Call the service to create the request message
> object based on the content received -->
>                <camel:bean ref="serviceHelper"
> method="createRequestMessage"/> // Receive as input parameter : Map<String,
> Object> and return a RequestMessage object
>
>                <!-- (2) Validate the business message -->
>                <camel:bean ref="serviceHelper"
> method="validateRequestMessage"/> // Receive as input parameter :
> RequestMessage and return a ValidationResultHolder containing List of
> Errors/ boolean isValid
>
>                <camel:choice>
>                    <camel:when>
>                        <camel:ognl>request.isValid = true</camel:ognl>
>
>                        <!-- (3) Save business message --> // Receive
as
> input parameter : RequestMessage and does not return anything ??????
>                        <camel:bean ref="serviceHelper"
> method="saveRequestMessage"/>
>                        <camel:to ref="queueRequestMessageEndpoint" />
>                    </camel:when>
>                    <camel:when>
>                        <camel:ognl>request.isValid = false</camel:ognl>
>                        <!-- (4) Error reported -->
>                        <camel:bean ref="serviceHelper"
> method="saveErrors"/>
>                        <camel:to ref="queueReportingEndpoint" />
>
>                    </camel:when>
>                </camel:choice>
>            </camel:split>
>        </camel:route>
>
> ISSUE : After calling the bean process : (2) Validate the business message,
> my RequestMessage is lost and replaced by a ValidationResultHolder
> containing information about List of Errors, boolean isValid BUT the
> requestMessage object is required in the process (3) Save business message
>
> Scenario possible to solve the issue :
>
> 1) Encapsulate RequestMessage class in the ValidationResultHolder class and
> use the ValidationResultHolder class as input parameter for (3) save
> business message process. Is it a good idea to copy objects between classes
> 2) Add property in the RequestMessage class to extract from
> ValidationResultHolder class : List of Errors/ boolean isValid(). Is the
> purpose of a java bean model class to expose result from a validation
> service ?
> 3) Merge service 1), 2) 3) into one. Granularity/flexility of Camel is lost
> 4) Use Java DSL instead of Spring DSL. Routing is hardcoded
>
> Question : Is a session context available to keep my requestMessage object
> during the validation process ?
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>

Mime
View raw message