Hi,

I am new to Servicemix. I am trying to use Servicemix in a active-active
configuration.
I have two instances of servicemix running on two different nodes and both
are in a cluster.
I have one initilization binding component which has a polling endpoint and
which resides only on one instance.
The messages sent by this initialization component should reach the service
engine residing on both the instances.
How can I do this in servicemix. What configurations do I need to do to
achieve this?

Currently I am using the JMS Flow and my servicemix.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!--

    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.

-->
<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
       xmlns:audit="http://servicemix.apache.org/audit/1.0";>

  <!-- System properties -->
  <sm:systemProperties>
    <property name="properties">
      <map>
        <entry key="java.security.auth.login.config">
          <bean class="org.springframework.util.ResourceUtils"
factory-method="getFile">
            <constructor-arg value="classpath:login.properties"/>
          </bean>
        </entry>
      </map>
    </property>
  </sm:systemProperties>

  <bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="location" value="classpath:servicemix.properties" />
  </bean>

  <!-- Include other resources -->
  <import resource="classpath:security.xml" />
  <import resource="classpath:jmx.xml" />
  <import resource="classpath:activemq.xml" />
  <import resource="classpath:tx.xml" />
  <import resource="classpath:jndi.xml" />

  <!-- the JBI container -->
  <sm:container id="jbi"
                rootDir="./data/smx"
          flowName="jms"
                MBeanServer="#jmxServer"
                installationDirPath="./hotdeploy"
                monitorDeploymentDirectory="false"
                monitorInterval="1"
                transactionManager="#transactionManager"
                createJmxConnector="false"
          name="servicemix_Kollam"
                depends-on="jndi">

    <!-- Use a secured broker (see security.xml)
         and define the 3 standard flows -->
    <sm:broker>
      <sm:securedBroker authorizationMap="#authorizationMap">
        <sm:flows>
          <sm:sedaFlow />
          <sm:jmsFlow jmsURL="${activemq.url}" />
          <sm:jcaFlow connectionManager="#connectionManager"
                      jmsURL="${activemq.url}" />
        </sm:flows>
      </sm:securedBroker>
    </sm:broker>

    <sm:services>
      <sm:statistics statsInterval="10" dumpStats="true" />
    </sm:services>

    <sm:executorFactory>
      <bean
class="org.apache.servicemix.executors.impl.ExecutorFactoryImpl">
        <property name="defaultConfig">
            <bean
class="org.apache.servicemix.executors.impl.ExecutorConfig">
              <property name="corePoolSize"
value="${servicemix.corePoolSize}"/>
              <property name="maximumPoolSize"
value="${servicemix.maximumPoolSize}"/>
              <property name="queueSize" value="${servicemix.queueSize}"/>
            </bean>
        </property>
        <property name="configs">
           <map>
            <entry key="component.hibernate-database-bc">
              <bean
class="org.apache.servicemix.executors.impl.ExecutorConfig">
                <property name="corePoolSize" value="1"/>
                <property name="maximumPoolSize" value="1"/>
                <property name="queueSize" value="1024"/>
              </bean>
            </entry>
            <entry key="flow.jms.hibernate-database-bc">
              <bean
class="org.apache.servicemix.executors.impl.ExecutorConfig">
                <property name="corePoolSize" value="5"/>
                <property name="maximumPoolSize" value="5"/>
                <property name="queueSize" value="1024"/>
              </bean>
            </entry>
           </map>
         </property>
      </bean>
    </sm:executorFactory>

    <sm:activationSpecs>

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

  <audit:jdbcAuditor container="#jbi" autoStart="false">
    <audit:dataSource>
      <bean class="org.apache.derby.jdbc.EmbeddedDataSource">
        <property name="databaseName" value="servicemixDB"/>
        <property name="createDatabase" value="create"/>
      </bean>
    </audit:dataSource>
  </audit:jdbcAuditor>

  <sm:dotViewService container="#jbi" autoStart="true" />

  <sm:logService container="#jbi" autoStart="true" refreshPeriod="60" />

</beans>


I send the message using this piece of code:

    InOnly exchange = getExchangeFactory().createInOnlyExchange();
        configureExchangeTarget(exchange);
        final NormalizedMessage message = exchange.createMessage();
        exchange.setInMessage(message);
        exchange.getInMessage().setProperty("prefdata", mapPrefdata);
        send(exchange);


Regards,
Akshatha

Reply via email to