You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jpuro <jp...@sterlingtesting.com> on 2006/09/05 17:23:52 UTC

Proxied Drools

I would like to use the jsr181:proxy configuration to proxy a call to a
lightweight drools component that I have configured, but I'm not sure I
understand how to do this.  The purpose of doing this is that I would like a
particular web service that I am exposing in ServiceMix to be able to call
an interface's method which when called calls into the ESB and then invokes
a drools component and returns a result from it.  Let's say I have the
following annotated web service.  I do not want the web service to know that
it is calling into ServiceMix to invoke the drools component.

@WebService
public class OrderService {

    private RuleService ruleService;

    @WebMethod
    public void submitOrder(Order order) {
        
        if ( ruleService.isValidOrder(order) ) {
                // Let's save the order now
                ...
        }

    }
}

Here's the interface for the RuleService:

public interface RuleService {
    
    public boolean isValidOrder(Order order);

}

Here is what I'm guessing the configuration may look like:

<sm:activationSpec>
	<sm:activationSpec componentName="droolsComponent"
service="test:droolsService">
		<sm:component>
			<bean class="org.apache.servicemix.components.drools.DroolsComponent">
				<property name="ruleBaseResource">
					<value>classpath:META-INF/rules/rulebase.xml</value>
				</property>
			</bean>
		</sm:component>
	</sm:activationSpec>
</sm:activationSpec>

<jsr181:proxy id="ruleServiceProxy"
  container="#jbi"
  service="test:droolsService"
  type="com.sterling.test.RuleService"/>

Any help would be appreciated.

Thanks,

Jeff
-- 
View this message in context: http://www.nabble.com/Proxied-Drools-tf2221424.html#a6154129
Sent from the ServiceMix - User forum at Nabble.com.


Re: Proxied Drools

Posted by Guillaume Nodet <gn...@gmail.com>.
Currently, the jsr181 proxy only supports JBI endpoints that
expose a WSDL.  This should be easy to fix, please raise a
JIRA for that.

As a workaround, you may want to write a simple WSDL
according to your java interface and override the
DroolsComponent to return this wsdl to the JBI container by
overriding:
    public Document getServiceDescription(ServiceEndpoint endpoint) {
        return null;
    }


On 9/5/06, jpuro <jp...@sterlingtesting.com> wrote:
>
>
> I would like to use the jsr181:proxy configuration to proxy a call to a
> lightweight drools component that I have configured, but I'm not sure I
> understand how to do this.  The purpose of doing this is that I would like
> a
> particular web service that I am exposing in ServiceMix to be able to call
> an interface's method which when called calls into the ESB and then
> invokes
> a drools component and returns a result from it.  Let's say I have the
> following annotated web service.  I do not want the web service to know
> that
> it is calling into ServiceMix to invoke the drools component.
>
> @WebService
> public class OrderService {
>
>     private RuleService ruleService;
>
>     @WebMethod
>     public void submitOrder(Order order) {
>
>         if ( ruleService.isValidOrder(order) ) {
>                 // Let's save the order now
>                 ...
>         }
>
>     }
> }
>
> Here's the interface for the RuleService:
>
> public interface RuleService {
>
>     public boolean isValidOrder(Order order);
>
> }
>
> Here is what I'm guessing the configuration may look like:
>
> <sm:activationSpec>
>         <sm:activationSpec componentName="droolsComponent"
> service="test:droolsService">
>                 <sm:component>
>                         <bean class="
> org.apache.servicemix.components.drools.DroolsComponent">
>                                 <property name="ruleBaseResource">
>
>                                         <value>classpath:META-INF/rules/rulebase.xml</value>
>                                 </property>
>                         </bean>
>                 </sm:component>
>         </sm:activationSpec>
> </sm:activationSpec>
>
> <jsr181:proxy id="ruleServiceProxy"
>   container="#jbi"
>   service="test:droolsService"
>   type="com.sterling.test.RuleService"/>
>
> Any help would be appreciated.
>
> Thanks,
>
> Jeff
> --
> View this message in context:
> http://www.nabble.com/Proxied-Drools-tf2221424.html#a6154129
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet