You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dunnlow <du...@yahoo.com> on 2011/08/23 02:33:25 UTC

Using a drools server in a route?

First, I'm pretty new to camel (and drools) and this question teeters between
the two.  I've combed the Drools forum for an answer to this question, but
the discussions there relate more to using camel within drools - they are
not camel centric.  So, my question:

I'm trying to find out the best best to integrate a call to a drools server
into my camel route.

I stood up a drools server and I can send a java bean to it via small java
client app that builds the drools command then makes a call to the rest
service (using HTTPClient).  The drools server looks at a few bean
attributes, sets a field accordingly and returns the result which I can
read.

Now, I'd like my camel application to use that service (basically a Content
Enricher) -- and I'll probably eventually route differently depending on the
return.  I believe I can move the code that builds the drools command, etc.
from my little client app and into a method in my Bean.  Then, I'd call that
bean method to send the response and another method to unmarshall/convert
it, like
...beanRef("myBean","sendToDrools").beanRef("myBean","convertDroolsResponse")....

It seems like I could use the cxf component to handle some of the data
transfer, but it seems like I would still need to build the drools command
and convert the results.

Isn't there a cleaner/better way?  I've looked at the camel section in the
drools integration guide, but no help.  

Any thoughts, best practices or references? 

Thanks very much,
-J






--
View this message in context: http://camel.465427.n5.nabble.com/Using-a-drools-server-in-a-route-tp4724999p4724999.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using a drools server in a route?

Posted by dunnlow <du...@yahoo.com>.
Willem, That is in fact the case - I am just calling the execute.  For
starters though, I've opted to implement this by creating a method in my
pojo that creates a new instance of itself based on information in the
header, sends itself to the service using httpclient, and loads the result
in to message body.  Then, i'll just call in the route.  we'll see....:) 
Thanks again.

--
View this message in context: http://camel.465427.n5.nabble.com/Using-a-drools-server-in-a-route-tp4724999p4735088.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using a drools server in a route?

Posted by Willem Jiang <wi...@gmail.com>.
On 8/23/11 8:21 PM, dunnlow wrote:
> Thanks for your response.  My application is a web-based, stand-alone Camel
> Spring application.  I have a separate server for Drools that should:
> receive pojo beans from my Camel app via web service, run my business rules,
> then return the result to my Camel app.
>
> My thought on the cxf component is to use it rather than using code in my
> bean to handle communication with the drools web service.  Does this seem
> like correct usage?
I don't think it's a good idea, unless the drools web service only has 
few operations like execute etc.
Because you should know the operation and prepare the parameter before 
sending the request from camel-cxf component.

>
> Thanks again for any insight.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-a-drools-server-in-a-route-tp4724999p4726590.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Using a drools server in a route?

Posted by dunnlow <du...@yahoo.com>.
Thanks for your response.  My application is a web-based, stand-alone Camel
Spring application.  I have a separate server for Drools that should:
receive pojo beans from my Camel app via web service, run my business rules,
then return the result to my Camel app.

My thought on the cxf component is to use it rather than using code in my
bean to handle communication with the drools web service.  Does this seem
like correct usage?

Thanks again for any insight.

--
View this message in context: http://camel.465427.n5.nabble.com/Using-a-drools-server-in-a-route-tp4724999p4726590.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using a drools server in a route?

Posted by Willem Jiang <wi...@gmail.com>.
Drool is just using the camel processor to integrate it with Camel.
Your drool bean way is another solution which is more easy way to expose 
the drool service to camel route.

I'm not sure why do you choice camel-cxf component, can you explain more 
about it ?


On 8/23/11 8:33 AM, dunnlow wrote:
> First, I'm pretty new to camel (and drools) and this question teeters between
> the two.  I've combed the Drools forum for an answer to this question, but
> the discussions there relate more to using camel within drools - they are
> not camel centric.  So, my question:
>
> I'm trying to find out the best best to integrate a call to a drools server
> into my camel route.
>
> I stood up a drools server and I can send a java bean to it via small java
> client app that builds the drools command then makes a call to the rest
> service (using HTTPClient).  The drools server looks at a few bean
> attributes, sets a field accordingly and returns the result which I can
> read.
>
> Now, I'd like my camel application to use that service (basically a Content
> Enricher) -- and I'll probably eventually route differently depending on the
> return.  I believe I can move the code that builds the drools command, etc.
> from my little client app and into a method in my Bean.  Then, I'd call that
> bean method to send the response and another method to unmarshall/convert
> it, like
> ...beanRef("myBean","sendToDrools").beanRef("myBean","convertDroolsResponse")....
>
> It seems like I could use the cxf component to handle some of the data
> transfer, but it seems like I would still need to build the drools command
> and convert the results.
>
> Isn't there a cleaner/better way?  I've looked at the camel section in the
> drools integration guide, but no help.
>
> Any thoughts, best practices or references?
>
> Thanks very much,
> -J
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-a-drools-server-in-a-route-tp4724999p4724999.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang