Hi Guilaume,

Thanks for the guidance. I have modified the servicemix-poller.xml and
servicemix-writer.xml to make the sample also works with servicemix-2.0.2 

servicemix-poller-1.xml:
==============
<?xml version="1.0" encoding="UTF-8"?>
<beans   
  xmlns="http://xbean.org/schemas/spring/1.0";
        xmlns:spring="http://xbean.org/schemas/spring/1.0";
        xmlns:sm="http://servicemix.org/config/1.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
                            http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
        xmlns:foo="http://servicemix.org/demo/";>


  <!-- the JBI container -->
  <sm:container id="jbi" name="poller-1" flowName="jms" dumpStats="true"
statsInterval="10" 
      useMBeanServer="false" createMBeanServer="false" >

    <sm:activationSpecs>

      <!-- Look for files in the inbox directory -->
      <sm:activationSpec componentName="filePoller"
                                destinationService="foo:fileSender" 
service="foo:filePoller">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0";
                                                
class="org.servicemix.components.file.FilePoller">
            <property name="workManager" ref="workManager" />
            <property name="file" value="inbox" />
            <property name="period" value="1000" />
          </bean>
        </sm:component>
      </sm:activationSpec>
    </sm:activationSpecs>
  </sm:container>

  <!-- the work manager (thread pool) for this container -->
  <bean id="workManager"
                class="org.jencks.factory.WorkManagerFactoryBean">
    <property name="threadPoolSize" value="30" />
  </bean>
</beans>

servicemix-poller-2.xml:
==============
<?xml version="1.0" encoding="UTF-8"?>
<beans   
  xmlns="http://xbean.org/schemas/spring/1.0";
        xmlns:spring="http://xbean.org/schemas/spring/1.0";
        xmlns:sm="http://servicemix.org/config/1.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
                            http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
        xmlns:foo="http://servicemix.org/demo/";>


  <!-- the JBI container -->
  <sm:container id="jbi" name="poller-2" flowName="jms" dumpStats="true"
statsInterval="10"
  useMBeanServer="false" createMBeanServer="false" >

    <sm:activationSpecs>

      <!-- Look for files in the inbox directory -->
      <sm:activationSpec componentName="filePoller"
                                destinationService="foo:fileSender" 
service="foo:filePoller">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0";
                                                
class="org.servicemix.components.file.FilePoller">
            <property name="workManager" ref="workManager" />
            <property name="file" value="inbox" />
            <property name="period" value="1000" />
          </bean>
        </sm:component>
      </sm:activationSpec>
    </sm:activationSpecs>
  </sm:container>

  <!-- the work manager (thread pool) for this container -->
  <bean id="workManager"
                class="org.jencks.factory.WorkManagerFactoryBean">
    <property name="threadPoolSize" value="30" />
  </bean>
</beans>

servicemix-writer-1.xml:
==============
<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://xbean.org/schemas/spring/1.0";
        xmlns:spring="http://xbean.org/schemas/spring/1.0";
        xmlns:sm="http://servicemix.org/config/1.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
                            http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
        xmlns:foo="http://servicemix.org/demo/";>
        <!-- the JBI container -->
        <sm:container id="jbi" name="writer-1" flowName="jms" dumpStats="true"
statsInterval="10" 
  useMBeanServer="false" createMBeanServer="false" >

                <sm:activationSpecs>

                        <!-- Write files to the outbox directory -->
                        <sm:activationSpec componentName="fileSender"
                                service="foo:fileSender">
                                <sm:component>
                                        <bean 
xmlns="http://xbean.org/schemas/spring/1.0";
                                                
class="org.servicemix.components.file.FileWriter">
                                                <property name="directory" 
value="outbox-1" />
                                                <property name="marshaler">
                                                        <bean
                                                                
class="org.servicemix.components.util.DefaultFileMarshaler">
                                                                <property 
name="fileName">
                                                                        <bean
                                                                                
class="org.servicemix.expression.JaxenStringXPathExpression">
                                                                                
<constructor-arg
                                                                                
        value="concat('sample_', /sample/@id, '.xml')" />
                                                                        </bean>
                                                                </property>
                                                        </bean>
                                                </property>
                                        </bean>
                                </sm:component>
                        </sm:activationSpec>

                </sm:activationSpecs>
        </sm:container>

        <!-- the work manager (thread pool) for this container -->
        <bean id="workManager"
                class="org.jencks.factory.WorkManagerFactoryBean">
                <property name="threadPoolSize" value="30" />
        </bean>
</beans>

servicemix-writer-2.xml:
===============
<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://xbean.org/schemas/spring/1.0";
        xmlns:spring="http://xbean.org/schemas/spring/1.0";
        xmlns:sm="http://servicemix.org/config/1.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
                            http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
        xmlns:foo="http://servicemix.org/demo/";>
        <!-- the JBI container -->
        <sm:container id="jbi" name="writer-2" flowName="jms" dumpStats="true"
statsInterval="10" 
  useMBeanServer="false" createMBeanServer="false" >

                <sm:activationSpecs>

                        <!-- Write files to the outbox directory -->
                        <sm:activationSpec componentName="fileSender"
                                service="foo:fileSender">
                                <sm:component>
                                        <bean 
xmlns="http://xbean.org/schemas/spring/1.0";
                                                
class="org.servicemix.components.file.FileWriter">
                                                <property name="directory" 
value="outbox-2" />
                                                <property name="marshaler">
                                                        <bean
                                                                
class="org.servicemix.components.util.DefaultFileMarshaler">
                                                                <property 
name="fileName">
                                                                        <bean
                                                                                
class="org.servicemix.expression.JaxenStringXPathExpression">
                                                                                
<constructor-arg
                                                                                
        value="concat('sample_', /sample/@id, '.xml')" />
                                                                        </bean>
                                                                </property>
                                                        </bean>
                                                </property>
                                        </bean>
                                </sm:component>
                        </sm:activationSpec>

                </sm:activationSpecs>
        </sm:container>

        <!-- the work manager (thread pool) for this container -->
        <bean id="workManager"
                class="org.jencks.factory.WorkManagerFactoryBean">
                <property name="threadPoolSize" value="30" />
        </bean>
</beans>

However, seems that this sample is not target to make the servicemix become
HA. Once a writer is down, pollers will lose the connectivity to it forever,
even if the writer will be up in a later time. 

May I know where we could find the sample on building a HA servicemix for
version 2.0.2 ? It will help us  lessen our concern on using servicemix in
production environment. :) 

Thanks and regards,
William
--
View this message in context: 
http://www.nabble.com/cluster%2C-two-machines-t1450987.html#a4136893
Sent from the ServiceMix - User forum at Nabble.com.

Reply via email to