You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by zhassan <za...@uspto.gov> on 2009/09/25 16:35:05 UTC

Re: Desparately need a drool equivalent example for serviceMix 4.1

Hi Ade,

Thanks for your reply. I am new to ServiceMix not that familiar with Camel
Route.  In any case. the example from SMX3.3 that I cited below works better
for my senario.  Where I invoke the BRE (drools) and  get the return form it
within the Java code, and proceed to next step of my senario.

Regards,
Zahid


Adrian Trenaman-2 wrote:
> 
> I've used Drools with Camel before: you could write a Camel custom
> processor that drops the incoming message from the Camel Exchange into a
> Drools engine and let the business rules fire away. Then, you could simply
> package the Camel route as an OSGi bundle and deploy into Servicemix 4. 
> 
> Cheers,
> Ade
> 
> ----- Original Message -----
> From: zhassan <za...@uspto.gov>
> To: users@servicemix.apache.org <us...@servicemix.apache.org>
> Sent: Wed Sep 23 15:51:45 2009
> Subject: Desparately need a drrol equivalent example for serviceMix 4.1
> 
> 
> Hi All, 
>   
> I am trying to migrate from smx3.3 to smx4.1.  I need an equivalent
> example
> (shown below) for drools. 
>   
> Any and all help is appreciated. 
>   
> Thanks, 
> Zahid 
>   
>   
> Ex for Smx3.3 
>   
> /* 
>  * Licensed to the Apache Software Foundation (ASF) under one or more 
>  * contributor license agreements.  See the NOTICE file distributed with 
>  * this work for additional information regarding copyright ownership. 
>  * The ASF licenses this file to You under the Apache License, Version 2.0 
>  * (the "License"); you may not use this file except in compliance with 
>  * the License.  You may obtain a copy of the License at 
>  * 
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  * 
>  * Unless required by applicable law or agreed to in writing, software 
>  * distributed under the License is distributed on an "AS IS" BASIS, 
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied. 
>  * See the License for the specific language governing permissions and 
>  * limitations under the License. 
>  */ 
> package loanbroker; 
>   
> import javax.jbi.messaging.ExchangeStatus; 
> import javax.jbi.messaging.InOnly; 
> import javax.jbi.messaging.InOut; 
> import javax.xml.namespace.QName; 
>   
> import org.w3c.dom.Element; 
>   
> import org.apache.servicemix.client.DefaultServiceMixClient; 
> import org.apache.servicemix.client.ServiceMixClient; 
> import org.apache.servicemix.drools.DroolsComponent; 
> import org.apache.servicemix.drools.DroolsEndpoint; 
> import org.apache.servicemix.jbi.container.JBIContainer; 
> import org.apache.servicemix.jbi.jaxp.SourceTransformer; 
> import org.apache.servicemix.jbi.jaxp.StringSource; 
> import org.apache.servicemix.tck.ReceiverComponent; 
> import org.springframework.core.io.ClassPathResource; 
>   
> import junit.framework.TestCase; 
>   
> public class CreditAgencyTest extends TestCase { 
>   
>     private JBIContainer jbi; 
>     private DroolsComponent drools; 
>     private ServiceMixClient client; 
>     
>     protected void setUp() throws Exception { 
>         super.setUp(); 
>         jbi = new JBIContainer(); 
>         jbi.setEmbedded(true); 
>         jbi.init(); 
>         client = new DefaultServiceMixClient(jbi); 
>     } 
>     
>     protected void tearDown() throws Exception { 
>         jbi.shutDown(); 
>     } 
>     
>     public void testCreditHistory() throws Exception { 
>         drools = new DroolsComponent(); 
>         DroolsEndpoint endpoint = new
> DroolsEndpoint(drools.getServiceUnit(), 
>                                                      new QName("drools"),
> "endpoint"); 
>         endpoint.setRuleBaseResource(new
> ClassPathResource("credit-agency.drl")); 
>         drools.setEndpoints(new DroolsEndpoint[] {endpoint }); 
>         jbi.activateComponent(drools, "servicemix-drools"); 
>         
>         jbi.start(); 
>         
>         InOut me = client.createInOutExchange(); 
>         me.setService(new QName("drools")); 
>         me.setOperation(new QName("urn:logicblaze:soa:creditagency",
> "getCreditHistoryLength")); 
>         me.getInMessage().setContent(new
> StringSource("<getCreditHistoryLengthRequest
> xmlns='urn:logicblaze:soa:creditagency'><ssn>123456</ssn></getCreditHistoryLengthRequest>")); 
>         client.sendSync(me); 
>         Element e = new
> SourceTransformer().toDOMElement(me.getOutMessage()); 
>         assertEquals("getCreditHistoryLengthResponse", e.getLocalName()); 
>         client.done(me); 
>         
>         Thread.sleep(50); 
>     } 
>   
> } 
>   
> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Desparately-need-a-drrol-equivalent-example-for-serviceMix-4.1-tp25531274p25531274.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Desparately-need-a-drrol-equivalent-example-for-serviceMix-4.1-tp25590449p25613220.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.