How to hot-deploy components within ServiceMix

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to hot-deploy components within ServiceMix

Jonathan.Edwards
Below is the current servicemix.xml that I have working for a simple example. Everything functions properly, but I'd like to extract the various activationSpec components from the servicemix.xml file and create something like a service assembly (I might be using the wrong terminology here) so that I can hot deploy these components to the JBI container. I can't tell from any of the examples a good way that I might achieve this. It seems like all I have to do is create a .zip file that contains all of my configuration files, and another jbi.xml file that defines my components, but none of the examples illustrate how to do this with something like the ChainedComponent or XsltComponent. Any help would be greatly appreciated.
 
 <?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 /opt/apps/servicemix/current/conf/spring-beans.xsd http://servicemix.org/config/1.0 /opt/apps/servicemix/current/conf/servicemix.xsd"
    xmlns:foo="http://servicemix.org/demo/">
    
  <!-- the JBI container --> 
  <sm:container
      spring:id="jbi"
      name="bus_2"
      useMBeanServer="true"
      createMBeanServer="true"
      monitorInstallationDirectory="false"
      dumpStats="true"
      statsInterval="10"
      flowName="jms?jmsURL=reliable:(<A href="tcp://uscobrmfa-ad-98:61616,tcp://uscobrmfa-ad-99:61616">tcp://uscobrmfa-ad-98:61616,tcp://uscobrmfa-ad-99:61616)"
      transactionManager="#transactionManager"
      rmiPort="5099">
     

    <sm:activationSpecs>
      <!-- Create a http server binding on port 8914  and have it forward to the foo:chain -->
      <sm:activationSpec componentName="httpReceiver"
          service="foo:httpReceiver"
          endpoint="httpReceiver"
          destinationService="foo:chain">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0"
              class="org.servicemix.components.http.HttpConnector">
            <property name="host" value="10.128.1.211"/>
            <property name="port" value="8914"/>
            <property name="defaultInOut" value="true"/>
          </bean>
        </sm:component>
      </sm:activationSpec>

      <!-- Lets create a message router -->
      <sm:activationSpec componentName="chain" service="foo:chain">
        <sm:component>
          <bean xmlns="" class="org.servicemix.components.util.ChainedComponent">
            <property name="services">
              <list>
                <bean class="javax.xml.namespace.QName">
                  <constructor-arg value="http://servicemix.org/demo/" />
                  <constructor-arg value="soapExtractor" />
                </bean>

                <bean class="javax.xml.namespace.QName">
                  <constructor-arg value="http://servicemix.org/demo/" />
                  <constructor-arg value="getPerson" />
                </bean>
                
                <bean class="javax.xml.namespace.QName">
                  <constructor-arg value="http://servicemix.org/demo/" />
                  <constructor-arg value="soapExtractor" />
                </bean>
                
                <bean class="javax.xml.namespace.QName">
                  <constructor-arg value="http://servicemix.org/demo/" />
                  <constructor-arg value="soapInjector" />
                </bean>
                
              </list>
            </property>
          </bean>
        </sm:component>
      </sm:activationSpec>

      <!-- Provide a service to strip SOAP headers -->
      <sm:activationSpec componentName="soapExtractor"
          service="foo:soapExtractor">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0"
              class="org.servicemix.components.xslt.XsltComponent">
            <property name="xsltResource" value="SoapExtractor.xsl"/>
          </bean>
        </sm:component>
      </sm:activationSpec>

      <!-- Provide a service to add SOAP headers -->
      <sm:activationSpec componentName="soapInjector"
          service="foo:soapInjector">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0"
              class="org.servicemix.components.xslt.XsltComponent">
            <property name="xsltResource" value="SoapInjector.xsl"/>
          </bean>
        </sm:component>
      </sm:activationSpec>
      
        <!-- This just invokes a SOAP web service -->
      <sm:activationSpec componentName="getPerson"
          service="foo:getPerson"
          endpoint="getPerson">
        <sm:component>
          <bean xmlns="http://xbean.org/schemas/spring/1.0"
              class="org.servicemix.components.saaj.SaajBinding">
            <property name="soapEndpoint">
              <bean class="javax.xml.messaging.URLEndpoint">
                <constructor-arg value="<A href='http://10.128.1.211:8080/systinet/server/CexpObjectTest/CexpObjectTest/"/'>http://10.128.1.211:8080/systinet/server/CexpObjectTest/CexpObjectTest/"/>
              </bean>
            </property>
          </bean>
        </sm:component>
      </sm:activationSpec>
    </sm:activationSpecs>
  </sm:container>

  <bean id="transactionContextManager" class="org.jencks.factory.TransactionContextManagerFactoryBean"/>

  <bean id="transactionManager" class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />

</beans>
Reply | Threaded
Open this post in threaded view
|

Re: How to hot-deploy components within ServiceMix

Guillaume Nodet
Administrator
The way to deploy a servicemix.xml file on an existing is not yet
document. Here are the steps to proceed (with svn head).

    o in the servicemix-lwcontainer directory, run "maven jbi:install".  
This should generate in the target\directory, a file named
servicemix-lwcontainer-installer-2.1-SNAPSHOT.zip.  This is a jbi
component that can be installed in a jbi container using
by copying it in the install directory which is monitored

    o modify your servicemix.xml file to change the "container" tag to a
"serviceunit"

    o put your servicemix.xml in a zip (which will be a service unit)

    o create a service assembly descriptor like this one, and zip it
along with your service unit
   

<jbi xmlns="http://java.sun.com/xml/ns/jbi"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/jbi"
     version="1.0">

 <service-assembly>
     <identification>
       <name>AU_1</name>
       <description>Sample AU</description>
     </identification>
     <service-unit>
       <identification>
         <name>SU_1</name>
         <description>Sample</description>
       </identification>
       <target>
         <artifacts-zip>su1.zip</artifacts-zip>
         <component-name>servicemix-lwcontainer</component-name>
       </target>
     </service-unit>
    </service-assembly>

</jbi>


    o drop your service assembly in the deploy directory of the
servicemix container

These steps are covered in
http://docs.codehaus.org/display/SM/Geronimo+Integration#GeronimoIntegration-DeployingJBIComponents
but this doc is not up-to-date yet.
This is still work in progress, so do not hesitate to ask if you have
any problems.

Cheers,

Guillaume Nodet

[hidden email] wrote:

> Below is the current servicemix.xml that I have working for a simple
> example. Everything functions properly, but I'd like to extract the
> various activationSpec components from the servicemix.xml file and
> create something like a service assembly (I might be using the wrong
> terminology here) so that I can hot deploy these components to the JBI
> container. I can't tell from any of the examples a good way that I
> might achieve this. It seems like all I have to do is create a .zip
> file that contains all of my configuration files, and another jbi.xml
> file that defines my components, but none of the examples illustrate
> how to do this with something like the ChainedComponent or
> XsltComponent. Any help would be greatly appreciated.
>  
>  <?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 
> /opt/apps/servicemix/current/conf/spring-beans.xsd
> <http://xbean.org/schemas/spring/1.0/opt/apps/servicemix/current/conf/spring-beans.xsd>
> http://servicemix.org/config/1.0 
> /opt/apps/servicemix/current/conf/servicemix.xsd
> <http://servicemix.org/config/1.0/opt/apps/servicemix/current/conf/servicemix.xsd>"
>     xmlns:foo="http://servicemix.org/demo/">
>    
>   <!-- the JBI container -->
>   <sm:container
>       spring:id="jbi"
>       name="bus_2"
>       useMBeanServer="true"
>       createMBeanServer="true"
>       monitorInstallationDirectory="false"
>       dumpStats="true"
>       statsInterval="10"
>      
> flowName="jms?jmsURL=reliable:(tcp://uscobrmfa-ad-98:61616,tcp://uscobrmfa-ad-99:61616)"
>       transactionManager="#transactionManager"
>       rmiPort="5099">
>      
>
>     <sm:activationSpecs>
>       <!-- Create a http server binding on port 8914  and have it
> forward to the foo:chain -->
>       <sm:activationSpec componentName="httpReceiver"
>           service="foo:httpReceiver"
>           endpoint="httpReceiver"
>           destinationService="foo:chain">
>         <sm:component>
>           <bean xmlns="http://xbean.org/schemas/spring/1.0"
>               class="org.servicemix.components.http.HttpConnector">
>             <property name="host" value="10.128.1.211
> <http://10.128.1.211>"/>
>             <property name="port" value="8914"/>
>             <property name="defaultInOut" value="true"/>
>           </bean>
>         </sm:component>
>       </sm:activationSpec>
>
>       <!-- Lets create a message router -->
>       <sm:activationSpec componentName="chain" service="foo:chain">
>         <sm:component>
>           <bean xmlns=""
> class="org.servicemix.components.util.ChainedComponent">
>             <property name="services">
>               <list>
>                 <bean class="javax.xml.namespace.QName">
>                   <constructor-arg value="http://servicemix.org/demo/" />
>                   <constructor-arg value="soapExtractor" />
>                 </bean>
>
>                 <bean class="javax.xml.namespace.QName">
>                   <constructor-arg value="http://servicemix.org/demo/" />
>                   <constructor-arg value="getPerson" />
>                 </bean>
>                
>                 <bean class="javax.xml.namespace.QName">
>                   <constructor-arg value="http://servicemix.org/demo/" />
>                   <constructor-arg value="soapExtractor" />
>                 </bean>
>                
>                 <bean class="javax.xml.namespace.QName">
>                   <constructor-arg value="http://servicemix.org/demo/" />
>                   <constructor-arg value="soapInjector" />
>                 </bean>
>                
>               </list>
>             </property>
>           </bean>
>         </sm:component>
>       </sm:activationSpec>
>
>       <!-- Provide a service to strip SOAP headers -->
>       <sm:activationSpec componentName="soapExtractor"
>           service="foo:soapExtractor">
>         <sm:component>
>           <bean xmlns="http://xbean.org/schemas/spring/1.0"
>               class="org.servicemix.components.xslt.XsltComponent">
>             <property name="xsltResource" value="SoapExtractor.xsl"/>
>           </bean>
>         </sm:component>
>       </sm:activationSpec>
>
>       <!-- Provide a service to add SOAP headers -->
>       <sm:activationSpec componentName="soapInjector"
>           service="foo:soapInjector">
>         <sm:component>
>           <bean xmlns="http://xbean.org/schemas/spring/1.0"
>               class="org.servicemix.components.xslt.XsltComponent">
>             <property name="xsltResource" value="SoapInjector.xsl"/>
>           </bean>
>         </sm:component>
>       </sm:activationSpec>
>      
>         <!-- This just invokes a SOAP web service -->
>       <sm:activationSpec componentName="getPerson"
>           service="foo:getPerson"
>           endpoint="getPerson">
>         <sm:component>
>           <bean xmlns="http://xbean.org/schemas/spring/1.0"
>               class="org.servicemix.components.saaj.SaajBinding">
>             <property name="soapEndpoint">
>               <bean class="javax.xml.messaging.URLEndpoint">
>                 <constructor-arg
> value="http://10.128.1.211:8080/systinet/server/CexpObjectTest/CexpObjectTest/"/
> <http://10.128.1.211:8080/systinet/server/CexpObjectTest/CexpObjectTest/%22/>>
>               </bean>
>             </property>
>           </bean>
>         </sm:component>
>       </sm:activationSpec>
>     </sm:activationSpecs>
>   </sm:container>
>
>   <bean id="transactionContextManager"
> class="org.jencks.factory.TransactionContextManagerFactoryBean"/>
>
>   <bean id="transactionManager"
> class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />
>
> </beans>