Thank you gert,
   1) Iam able to call my rules now without any error.
   2) The example i was using is simply routing a message based on the
content of message, which can be easily done with Content Based Router
   Now i want to do routing based on the source component of the message
from where the message is coming i.e, i want to remove the tap's(used for
debugging) at runtime using drools.

My component setup is

   JMS queue(Consumer)-->eip:Tap1-->eip:Content Based
Router-->eip:Tap2--->eip:Transformer

Now i want to enable/disable Tap1 and Tap2 during runtime by using drools,
for that purpose i planned to have my component setup as follows

   JMS
queue(Consumer)-->SA(DroolsComponent)eip:Tap1-->SA(DroolsComponent)--->eip:Content
Based
Router-->SA(DroolsComponent)--->eip:Tap2--->SA(DroolsComponent)-->eip:Transformer

the logic in rules files should be as follows

if source component is JMS queue, route to Tap1
if source component is Tap1, route to Content based router
if source component is ContentBaseRouter, route to Tap2
if source component is Tap2, route to Transformer


How can i write this kind of rules,please help me in this regard.
Also let me know is it a feasible way of adding/removing components
logically?






Gert Vanthienen wrote:
> 
> Arif,
> 
> 
> You can find a description on how to form this kind of URIs on 
> http://incubator.apache.org/servicemix/uris.html.
> 
> If you think the URI is correct but still have these 'Cannot find route 
> to ...' errors, you can use a JMX console to verify which endpoints are 
> actually available on the ESB.  I think your service URI contained the 
> endpoint name, where it should only hold the service name.
> 
> 
> Gert
> 
> Arif Mohd wrote:
>> Hi Rabi,
>> 
>>     I didn't understand this concept of giving service name as
>> "service:http://xxx.com/bescocr_031807/tap1"; but still it is not working
>> 
>>    Can you please elobarate what is the meaning of the above statement, i
>> agree that previously i have missed to preceede the service name with
>> namespace i.e, i should have given like
>> 
>> jbi.route( "service:bescocr:tap1" );
>> 
>> But even the above statement is not working
>> 
>> 
>> rabi wrote:
>>>
>>> in your routing.drl replace
>>>  
>>>  jbi.route( "bescocr::tap1" ); with
>>>  
>>> jbi.route("service:http://xxx.com/bescocr_031807
>>> <https://webmail.wipro.com/exchweb/bin/redir.asp?URL=http://xxx.com/bescocr_031807>
>>> /tap1");
>>>  
>>> and                 jbi.route( "bescocr::tap2" ); with
>>>
>>> jbi.route("service:http://xxx.com/bescocr_031807
>>> <https://webmail.wipro.com/exchweb/bin/redir.asp?URL=http://xxx.com/bescocr_031807>
>>> /tap2");
>>>  
>>> Regards, 
>>> Rabi Mishra 
>>> http://rabisblog.blogspot.com/
>>>
>>> ________________________________
>>>
>>> From: Arif Mohd [mailto:[EMAIL PROTECTED]
>>> Sent: Wed 6/20/2007 7:25 PM
>>> To: [email protected]
>>> Subject: Problem while invoking rule by using drools component
>>>
>>>
>>>
>>>
>>> Hi,
>>>  
>>>    Iam having the following setup
>>>
>>> JMS queue(Consumer)-->eip:Content Based
>>> Router-->SA(DroolsComponent)-->eip:TAP1 or eip:TAP2(Based on rule base)
>>>
>>> part of xbean.xml for "eip:Content Based Router" is
>>>
>>>       <eip:routing-rule>
>>>         <eip:predicate>
>>>           <eip:xpath-predicate xpath="/Record/eid = 100"
>>> namespaceContext="#nsContext" />
>>>         </eip:predicate>
>>>         <eip:target>
>>>           <eip:exchange-target service="bescocr:myDroolsService" />
>>>         </eip:target>
>>>       </eip:routing-rule>
>>>
>>> xbean.xml for DroolsComponent(SU) is
>>>
>>> <beans xmlns:drools="http://servicemix.apache.org/drools/1.0";
>>>        xmlns:bescocr="http://xxx.com/bescocr_031807";>
>>> <drools:endpoint
>>>      service="bescocr:myDroolsService"
>>>      endpoint="endpoint"
>>>      ruleBaseResource="classpath:routing.drl"/>
>>> </beans>
>>>
>>>
>>> routing.drl is
>>>
>>> package org.apache.servicemix.drools
>>> import org.apache.servicemix.drools.model.Exchange;
>>> global org.apache.servicemix.drools.model.JbiHelper jbi;
>>>
>>> rule "Route to tap1"
>>>         when
>>>                 me : Exchange( status == Exchange.ACTIVE, in : in !=
>>> null
>>> )
>>>                 eval( in.xpath("/Record/eid = 100") )
>>>         then
>>>                 jbi.route( "bescocr::tap1" );
>>> end
>>>
>>> rule "Route to tap2"
>>>         when
>>>                 me : Exchange( status == Exchange.ACTIVE, in : in !=
>>> null
>>> )
>>>                 eval( in.xpath("/Record/eid = 101") )
>>>         then
>>>                 jbi.route( "bescocr::tap2" );
>>> end
>>>
>>>
>>> with the above setup iam getting the following exception "for service:
>>> null
>>> and interface: null" the exception is as follows, do i need to set
>>> something
>>> else in xbean.xml?
>>>
>>> javax.jbi.messaging.MessagingException: Could not find route for
>>> exchange:
>>> InOnly[
>>>   id: ID:EC4T16INT165110-4730-1182344415869-7:0
>>>   status: Active
>>>   role: provider
>>>   in: <My Message>
>>> ] for service: null and interface: null
>>>         at
>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:295)
>>>         at
>>> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:80)
>>>         at
>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:793)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:381)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:456)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:428)
>>>         at
>>> org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:88)
>>>         at
>>> org.apache.servicemix.drools.model.JbiHelper.route(JbiHelper.java:109)
>>>         at
>>> org.apache.servicemix.drools.Rule_Route_to_tap1_0.consequence(Rule_Route_to_tap1_0.java:11)
>>>         at
>>> org.apache.servicemix.drools.Rule_Route_to_tap1_0ConsequenceInvoker.evaluate(Rule_Route_to_tap1_0ConsequenceInvoker.ja
>>> va:19)
>>>         at org.drools.common.DefaultAgenda.fireActivation(Unknown
>>> Source)
>>>         at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
>>>         at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown
>>> Source)
>>>         at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown
>>> Source)
>>>         at
>>> org.apache.servicemix.drools.DroolsEndpoint.drools(DroolsEndpoint.java:150)
>>>         at
>>> org.apache.servicemix.drools.DroolsEndpoint.process(DroolsEndpoint.java:141)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:441)
>>>         at
>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>>>         at java.lang.Thread.run(Thread.java:595)
>>> ERROR - DroolsComponent                - Error processing exchange
>>> InOnly[
>>>   id: ID:EC4T16INT165110-4730-1182344415869-3:2
>>>   status: Active
>>>   role: provider
>>>   service: {http://xxx.com/bescocr_031807}myDroolsService
>>>   endpoint: endpoint
>>>   in: <My Message>
>>> ]
>>> org.drools.spi.ConsequenceException:
>>> javax.jbi.messaging.MessagingException:
>>> Could not find route for exchange: InOnly[
>>>   id: ID:EC4T16INT165110-4730-1182344415869-7:0
>>>   status: Active
>>>   role: provider
>>>   in: <My Message>
>>> ] for service: null and interface: null
>>>         at org.drools.common.DefaultAgenda.fireActivation(Unknown
>>> Source)
>>>         at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
>>>         at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown
>>> Source)
>>>         at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown
>>> Source)
>>>         at
>>> org.apache.servicemix.drools.DroolsEndpoint.drools(DroolsEndpoint.java:150)
>>>         at
>>> org.apache.servicemix.drools.DroolsEndpoint.process(DroolsEndpoint.java:141)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:441)
>>>         at
>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>>>         at java.lang.Thread.run(Thread.java:595)
>>> Caused by: javax.jbi.messaging.MessagingException: Could not find route
>>> for
>>> exchange: InOnly[
>>>   id: ID:EC4T16INT165110-4730-1182344415869-7:0
>>>   status: Active
>>>   role: provider
>>>   in: <My Message>
>>> ] for service: null and interface: null
>>>         at
>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:295)
>>>         at
>>> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:80)
>>>         at
>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:793)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:381)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:456)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:428)
>>>         at
>>> org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:88)
>>>         at
>>> org.apache.servicemix.drools.model.JbiHelper.route(JbiHelper.java:109)
>>>         at
>>> org.apache.servicemix.drools.Rule_Route_to_tap1_0.consequence(Rule_Route_to_tap1_0.java:11)
>>>         at
>>> org.apache.servicemix.drools.Rule_Route_to_tap1_0ConsequenceInvoker.evaluate(Rule_Route_to_tap1_0ConsequenceInvoker.ja
>>> va:19)
>>>         ... 16 more
>>> ERROR - JmsComponent                   - Error processing exchange
>>> InOnly[
>>>   id: ID:EC4T16INT165110-4730-1182344415869-4:0
>>>   status: Error
>>>   role: consumer
>>>   service: {http://xxx.com/bescocr_031807}JmsToPipeTapSvc
>>>   endpoint: tap
>>>   in: <My Message>
>>>   error: org.drools.spi.ConsequenceException:
>>> javax.jbi.messaging.MessagingException: Could not find route for
>>> exchange:
>>> InOnly[
>>>   id: ID:EC4T16INT165110-4730-1182344415869-7:0
>>>   status: Active
>>>   role: provider
>>>   in: <My Message>
>>> ] for service: null and interface: null
>>> ]
>>> java.lang.UnsupportedOperationException: A destination must be
>>> specified.
>>>         at
>>> org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:448)
>>>         at
>>> org.apache.activemq.pool.PooledProducer.send(PooledProducer.java:75)
>>>         at
>>> org.apache.activemq.pool.PooledProducer.send(PooledProducer.java:60)
>>>         at
>>> org.apache.servicemix.jms.multiplexing.MultiplexingConsumerProcessor.process(MultiplexingConsumerProcessor.java:125)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
>>>         at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:463)
>>>         at
>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>>>         at java.lang.Thread.run(Thread.java:595)
>>> ERROR - JmsComponent                   - Error setting exchange status
>>> to
>>> ERROR
>>> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>>>         at
>>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:571)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:370)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:417)
>>>         at
>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:58)
>>>         at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>>>         at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>>>         at
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>>>         at java.lang.Thread.run(Thread.java:595)
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Problem-while-invoking-rule-by-using-drools-component-tf3952519s12049.html#a11213830
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>>>
>>>
>>>
>>> The information contained in this electronic message and any attachments
>>> to this message are intended for the exclusive use of the addressee(s)
>>> and
>>> may contain proprietary, confidential or privileged information. If you
>>> are not the intended recipient, you should not disseminate, distribute
>>> or
>>> copy this e-mail. Please notify the sender immediately and destroy all
>>> copies of this message and any attachments. 
>>>
>>> WARNING: Computer viruses can be transmitted via email. The recipient
>>> should check this email and any attachments for the presence of viruses.
>>> The company accepts no liability for any damage caused by any virus
>>> transmitted by this email.
>>>  
>>> www.wipro.com
>>>
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-while-invoking-rule-by-using-drools-component-tf3952519s12049.html#a11519195
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to