You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by sachin2008 <es...@gmail.com> on 2008/04/15 19:57:22 UTC

Re: Problems with in.valueOf() function in jbiHelper

Thanks Lars..
I have more question. 
  file i have scenrio like this
    In my drools file i have to check some conditions and based upon this i
need to return the IN message contents to OUT message. 

Generally we will be using jbi.answer("  ") to send response from drools
endpoint. But the problem is as it accepts only string content , i have to
convert the IN message into string explicitly and then send ti jbi.answer(). 
Is there any other way to this because converting a mesage into string is
taking more time.

I tries the following also. I just replicate the answer() method of
jbiHelper but i am getting the following error

java.lang.IllegalStateException: component is not owner when trying to set
error: java.lang.Exception: No rules have handled the exchange


But when i converet the In message into string and call answer() method its
works fine. 
The only statement which is thre in the answer() method of jbiHelper but not
in my statement is update()

Is there any way to solve this.



lhe77 wrote:
> 
> btw. the original JIRA issue was SM-924.
> 
> 
> 
> Lars Heinemann schrieb:
>> It is available since version 3.2.
>>
>> Regards
>> Lars
>>
>>
>>
>> sachin2008 schrieb:
>>   
>>> Thanks for your help. 
>>> Which version of servicemix supports in.valueOf() function. 
>>>
>>>
>>>
>>>
>>> Lars Heinemann wrote:
>>>   
>>>     
>>>> Question 1:
>>>>
>>>> The method valueOf(String) of the Message class is simply not available 
>>>> in ServiceMix 3.1.
>>>>
>>>>
>>>> Question 2:
>>>>
>>>> The source code of this method is this: (servicemix 3.1)
>>>>
>>>> public boolean xpath(String xpath) throws Exception {
>>>>         JAXPBooleanXPathExpression expression = new 
>>>> JAXPBooleanXPathExpression(xpath);
>>>>         Boolean b = (Boolean) expression.evaluate(null, message);
>>>>         return b.booleanValue();
>>>>     }
>>>>
>>>> I suppose you have to have a look at the evaluate method of the 
>>>> JAXPBooleanXPathExpression class.
>>>>
>>>> Regards,
>>>> Lars
>>>>
>>>>
>>>>
>>>>
>>>> sachin2008 schrieb:
>>>>     
>>>>       
>>>>> HI ,  i have 2 queries regarding drools usage
>>>>>
>>>>> Question 1:
>>>>> -------------
>>>>>
>>>>> I have developed a small drl file using eclipse drools plugin. 
>>>>>
>>>>> In this file i have used the funtion in.valueOf() which is provided by
>>>>> the
>>>>> Message class of JBIHelper.
>>>>>
>>>>> In the eclipse program with drools IDE it works fine but when i use
>>>>> the
>>>>> same
>>>>> drl file in the servicemix 3.1 by creating a servicemix-drools su i am
>>>>> getting the following error while deploying the SA.
>>>>>
>>>>> in.valueOf(String) not found in Message........
>>>>>
>>>>> Then i removed all these statements. But now , the SA is getting
>>>>> deployed
>>>>> sucessfully but when i send a request to the drl file, i am getting
>>>>> the
>>>>> following exception.
>>>>>
>>>>> java.lang.Exception: No Matching rules found. Check your rule base.
>>>>>
>>>>> What could be the reason for this. 
>>>>>
>>>>> Question 2: 
>>>>> I am using  xpath queries so many times in the following way:
>>>>>      eval(in.xpath("//status"))
>>>>> To perform this operation , the contents of IN message needs to be
>>>>> converted
>>>>> into DOM  and this will be done by JAXPXPathExpression.java
>>>>> internally.
>>>>> But
>>>>> my question is does it converts the IN message in to a dom node for
>>>>> each
>>>>> and
>>>>> every xpath query in the drl file or caches some where. 
>>>>> If it converts the In Message into DOM every time then the performance
>>>>> will
>>>>> be effected . Am i right. 
>>>>>
>>>>> Please clarify these based upon these i need to decide whether i can
>>>>> go
>>>>> for
>>>>> drools or not . 
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> Cheers
>>>>> Praveen Oruganti
>>>>> "Think before you act and act on what you believe"
>>>>>   
>>>>>       
>>>>>         
>>>>     
>>>>       
>>> -----
>>> Cheers
>>> Praveen Oruganti
>>> "Think before you act and act on what you believe"
>>>   
>>>     
>>
>>   
> 
> 


-----
Cheers
Praveen Oruganti
"Think before you act and act on what you believe"
-- 
View this message in context: http://www.nabble.com/Problems-with-in.valiueOf%28%29-function-in-jbiHelper-tp16678800p16703415.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problems with in.valueOf() function in jbiHelper

Posted by lhein <lh...@apache.org>.
Sachin,

I added new methods to the JbiHelper class now supporting Source objects as
content.

See:
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-drools/src/main/java/org/apache/servicemix/drools/model/JbiHelper.java?view=markup

You can now call answer method with a Source parameter (for instance your
inMsg.getContent()).
But this change is only available in the trunk version. So if you want to
try it, you need to get the latest snapshot or build it on your own. 

Regards
Lars



sachin2008 wrote:
> 
> Thanks Lars..
> I have more question. 
>   file i have scenrio like this
>     In my drools file i have to check some conditions and based upon this
> i need to return the IN message contents to OUT message. 
> 
> Generally we will be using jbi.answer("  ") to send response from drools
> endpoint. But the problem is as it accepts only string content , i have to
> convert the IN message into string explicitly and then send ti
> jbi.answer().  Is there any other way to this because converting a mesage
> into string is taking more time.
> 
> I tries the following also. I just replicate the answer() method of
> jbiHelper but i am getting the following error
> 
> java.lang.IllegalStateException: component is not owner when trying to set
> error: java.lang.Exception: No rules have handled the exchange
> 
> 
> But when i converet the In message into string and call answer() method
> its works fine. 
> The only statement which is thre in the answer() method of jbiHelper but
> not in my statement is update()
> 
> Is there any way to solve this.
> 
> 
> 
> lhe77 wrote:
>> 
>> btw. the original JIRA issue was SM-924.
>> 
>> 
>> 
>> Lars Heinemann schrieb:
>>> It is available since version 3.2.
>>>
>>> Regards
>>> Lars
>>>
>>>
>>>
>>> sachin2008 schrieb:
>>>   
>>>> Thanks for your help. 
>>>> Which version of servicemix supports in.valueOf() function. 
>>>>
>>>>
>>>>
>>>>
>>>> Lars Heinemann wrote:
>>>>   
>>>>     
>>>>> Question 1:
>>>>>
>>>>> The method valueOf(String) of the Message class is simply not
>>>>> available 
>>>>> in ServiceMix 3.1.
>>>>>
>>>>>
>>>>> Question 2:
>>>>>
>>>>> The source code of this method is this: (servicemix 3.1)
>>>>>
>>>>> public boolean xpath(String xpath) throws Exception {
>>>>>         JAXPBooleanXPathExpression expression = new 
>>>>> JAXPBooleanXPathExpression(xpath);
>>>>>         Boolean b = (Boolean) expression.evaluate(null, message);
>>>>>         return b.booleanValue();
>>>>>     }
>>>>>
>>>>> I suppose you have to have a look at the evaluate method of the 
>>>>> JAXPBooleanXPathExpression class.
>>>>>
>>>>> Regards,
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> sachin2008 schrieb:
>>>>>     
>>>>>       
>>>>>> HI ,  i have 2 queries regarding drools usage
>>>>>>
>>>>>> Question 1:
>>>>>> -------------
>>>>>>
>>>>>> I have developed a small drl file using eclipse drools plugin. 
>>>>>>
>>>>>> In this file i have used the funtion in.valueOf() which is provided
>>>>>> by
>>>>>> the
>>>>>> Message class of JBIHelper.
>>>>>>
>>>>>> In the eclipse program with drools IDE it works fine but when i use
>>>>>> the
>>>>>> same
>>>>>> drl file in the servicemix 3.1 by creating a servicemix-drools su i
>>>>>> am
>>>>>> getting the following error while deploying the SA.
>>>>>>
>>>>>> in.valueOf(String) not found in Message........
>>>>>>
>>>>>> Then i removed all these statements. But now , the SA is getting
>>>>>> deployed
>>>>>> sucessfully but when i send a request to the drl file, i am getting
>>>>>> the
>>>>>> following exception.
>>>>>>
>>>>>> java.lang.Exception: No Matching rules found. Check your rule base.
>>>>>>
>>>>>> What could be the reason for this. 
>>>>>>
>>>>>> Question 2: 
>>>>>> I am using  xpath queries so many times in the following way:
>>>>>>      eval(in.xpath("//status"))
>>>>>> To perform this operation , the contents of IN message needs to be
>>>>>> converted
>>>>>> into DOM  and this will be done by JAXPXPathExpression.java
>>>>>> internally.
>>>>>> But
>>>>>> my question is does it converts the IN message in to a dom node for
>>>>>> each
>>>>>> and
>>>>>> every xpath query in the drl file or caches some where. 
>>>>>> If it converts the In Message into DOM every time then the
>>>>>> performance
>>>>>> will
>>>>>> be effected . Am i right. 
>>>>>>
>>>>>> Please clarify these based upon these i need to decide whether i can
>>>>>> go
>>>>>> for
>>>>>> drools or not . 
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -----
>>>>>> Cheers
>>>>>> Praveen Oruganti
>>>>>> "Think before you act and act on what you believe"
>>>>>>   
>>>>>>       
>>>>>>         
>>>>>     
>>>>>       
>>>> -----
>>>> Cheers
>>>> Praveen Oruganti
>>>> "Think before you act and act on what you believe"
>>>>   
>>>>     
>>>
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-in.valiueOf%28%29-function-in-jbiHelper-tp16678800p16713297.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.