Hi gnodet,
   can you please reply.

Arif Mohd wrote:
> 
> Hi gnodet,
>   
>   I read the blog, can you please elobarate where and how to configure the
> Data base url,username, password inside the servicemix?
> 
>      You have given the jndiName as follows
>                <property name="jndiName" value="java:myDataBase" /> 
> 
>      but where is the myDataBase configured?
>      One more general question, Is it the right way of putting business
> logic inside ESB?
> 
> 
> gnodet wrote:
>> 
>> Nicely written, Andrea, thanks !
>> Btw, you may be interested in a recent change in servicemix-drools:
>> the ability to inject beans configured inside the xbean.xml into the
>> rules
>> definition file (such as a helper with a configured dataSource for
>> example).
>> See 
>> http://gnodet.blogspot.com/2007/06/accessing-databases-in-servicemix.html
>> 
>> On 6/29/07, Andrea Zoppello <[EMAIL PROTECTED]> wrote:
>>> I've already done this by extendig not only the drools component but
>>> also,
>>> the class org.apache.servicemix.drools.model.Message with a method like
>>> this:รน
>>>
>>> org.apache.servicemix.drools.model:
>>>
>>> public String valueOf(String xpath) throws Exception {
>>>         JAXPStringXPathExpression expression = new
>>> JAXPStringXPathExpression(xpath);
>>>         if (this.namespaceContext != null)
>>>             expression.setNamespaceContext(this.namespaceContext);
>>>         String res = (String)expression.evaluate(null, message);
>>>         return res;
>>>     }
>>>
>>> at this point in you can use your dbHelper in drools as follow:
>>>
>>>        
>>> dbh.isDomestic(in.valueOf('/MESSAGE/@par1'),in.valueOf('/MESSAGE/@par2'))
>>>
>>>
>>>
>>> in this example i assume the incoming message is something like:
>>>
>>>     <MESSAGE par1="PAR1" par2="PAR2">
>>>     </MESSAGE>
>>>
>>> Andrea Zoppello
>>> Engineering Ing. Informatica.
>>>
>>>
>>>
>>> pksahoo ha scritto:
>>>
>>> > Hi ,
>>> >
>>> > I am new to Drool and need some help . I have done integration of
>>> > Drool with database.
>>> >
>>> > I am calling DB helper class memeber function in
>>> > Drool.
>>> >
>>> > In my Drool file (.drl) file, I need to pass 2
>>> > parameter as input . Basically, I have to provide
>>> > source airport code and destination airport code to my
>>> > rule engine. it will call the database and based on
>>> > query, it will return domestic or international.
>>> >
>>> > How can I pass the input parameter to Drool as
>>> > variable? Right now, it is hard coded in drool file
>>> > like dbh.isDomestic("JFK", "YYZ") .  Here is the .drl
>>> > file:
>>> >
>>> > package org.apache.servicemix.drools
>>> >
>>> > import org.apache.commons.logging.Log;
>>> > import org.apache.commons.logging.LogFactory;
>>> > import org.apache.servicemix.drools.model.Exchange;
>>> >
>>> > import loanbroker.DbHelper;
>>> >
>>> > global org.apache.servicemix.drools.model.JbiHelper
>>> > jbi;
>>> >
>>> >
>>> > rule TourType
>>> >       when
>>> >               me : Exchange( status == Exchange.ACTIVE, in : in !=
>>> > null, operation ==
>>> > "{urn:logicblaze:soa:creditagency}getCreditHistoryLength")
>>> >       then
>>> >               DbHelper dbh = new DbHelper();
>>> >               jbi.answer("<TourTypeResponse><name>" +
>>> >                       dbh.isDomestic("JFK", "YYZ") +
>>> >                       "</name></TourTypeResponse>");
>>> > end
>>> >
>>> >
>>> > Please advise.
>>> > Regards,
>>> > Prasanta
>>> >
>>> >
>>> >
>>>
>>>
>> 
>> 
>> -- 
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Principal Engineer, IONA
>> Blog: http://gnodet.blogspot.com/
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-pass-parameter-into-Servicemix-Drool-3.2-rule-.-tf3996673s12049.html#a11412574
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to