Hey Guillaume,
Thanks a lot for the information. I have tried using the following:

/<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0";>

 <!-- the JBI container -->
 <sm:container id="jbi"
               rootDir="./wdir"
               installationDirPath="./install"
               deploymentDirPath="./deploy"
               flowName="st">
   <sm:broker>
     <bean class="org.apache.servicemix.jbi.nmr.Broker">
       <property name="defaultServiceChooser">
<bean class="org.apache.servicemix.jbi.resolver.RandomChoicePolicy" />
       </property>
     </bean>
   </sm:broker>

   <sm:activationSpecs>
... </sm:activationSpecs>
 </sm:container>
</beans>/

to set the global policy on the broker, but this makes ServiceMix crash and yields the following error:


Apache ServiceMix ESB: 3.0-M1
Loading Apache ServiceMix from file: servicemix.xml

Caught: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jbi' defined in file [C:\WIT-CASE\servicemix-3.0-M1\examples\ActiveBpelSetup\servicemix.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'broker' of bean class [org.apache.servicemix.jbi.container.SpringJBIContainer]:
Bean property 'broker' is not writable or has an invalid setter method:
Does the parameter type of the setter match the return type of the getter?

org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jbi' defined in file [C:\WIT-CASE\servicemix-3.0-M1\examples\ActiveBpelSetup\servicemix.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'broker' of bean class [org.apache.servicemix.jbi.container.SpringJBIContainer]:
Bean property 'broker' is not writable or has an invalid setter method:
Does the parameter type of the setter match the return type of the getter?

org.springframework.beans.NotWritablePropertyException:
Invalid property 'broker' of bean class [org.apache.servicemix.jbi.container.SpringJBIContainer]:
Bean property 'broker' is not writable or has an invalid setter method:
Does the parameter type of the setter match the return type of the getter?

at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:567) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:469) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:626) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:653) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:642) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1023) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:824) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320) at org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:149) at org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:48)
       at org.apache.servicemix.Main.main(Main.java:74)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:461)


Any idea how this can be solved?

Kind regards,
Tom


Guillaume Nodet schreef:

You need to set the policy either on the activationSpec
for the component that send the exchange.
You can also set the global policy on the broker.

<sm:activationSpec ..>
 <sm:serviceChooser>
   <bean class="org.apache.servicemix.jbi.resolver.RandomChoicePolicy" />
 </sm:serviceChooser>
 ..
</sm:activationSpec>

change the tag to <sm:interfaceChooser/> if the component use interfaces
to address the target.

On the broker, something like the following should work:
 <sm:container ...>
   <sm:broker>
     <bean class="org.apache.servicemix.jbi.nmr.DefaultBroker">
       <property name="defaultServiceChooser">
<bean class="org.apache.servicemix.jbi.resolver.RandomChoicePolicy" />
       </property>
     </bean>
   </sm:broker>
   ...
 </sm:container>

Though for load-balancing across several JBI containers / processes,
using a jms flow, or a plain jms queue would work better imho ...

On 12/11/06, Tom <[EMAIL PROTECTED]> wrote:

Hello all,

I'm currently trying to use two services (both the same) to do some load
balancing tests, but I can't seem to enable the RandomChoicePolicy.  Has
anybody some experience with this? And if so, could you post a small
code snippet with some explanation?

Thanks in advance,
Tom




Reply via email to