LibraryToggle FramesPrintFeedback

To generate the new project, perform the following steps:

  1. Open a new command window and change to the directory where you want to store the new Maven project.

  2. Enter the following command to generate the new Maven project:

    mvn archetype:create
      -DremoteRepositories=https://repository.apache.org/content/groups/public
      -DarchetypeGroupId=org.apache.camel.archetypes
      -DarchetypeArtifactId=camel-archetype-java
      -DarchetypeVersion=2.8.0-fuse-00-08
      -DgroupId=tutorial
      -DartifactId=tx-jms-router

    This command generates a basic router application under the tx-jms-router directory. You will customize this basic application to demonstrate transactions in .Fuse Mediation Router

    [Note]Note

    Maven accesses the Internet to download JARs and stores them in its local repository.

  3. Customize the project POM file, tx-jms-router/pom.xml, by adding some new project dependencies. First of all, define some properties for the dependency versions. Using your favorite text editor, open the POM file and add a spring-version property and an activemq-version property as follows:

    <project ...>
      ...
      <properties>
        ...
        <spring-version>3.0.5.RELEASE</spring-version>
        <activemq-version>5.5.1-fuse-00-08</activemq-version>
        <xbean-version>3.7</xbean-version>
      </properties>
      ...
    </project>
  4. Add dependencies on the artifacts that implement Spring transactions. Look for the dependencies element in the POM file and add the following dependency elements:

    <project ...>
      ...
      <dependencies>
        ...
        <!-- Spring transaction dependencies -->
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>${spring-version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>${spring-version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-tx</artifactId>
          <version>${spring-version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-aop</artifactId>
          <version>${spring-version}</version>
        </dependency>
    
      </dependencies>
      ...
    </project>
  5. Add the JMS and ActiveMQ dependencies. Look for the dependencies element in the POM file and add the following dependency elements:

    <project ...>
      ...
      <dependencies>
        ...
        <!-- Persistence artifacts -->
        <dependency> 
          <groupId>org.apache.camel</groupId> 
          <artifactId>camel-jms</artifactId> 
          <version>${camel-version}</version>
        </dependency> 
        <dependency> 
          <groupId>org.apache.activemq</groupId> 
          <artifactId>activemq-core</artifactId> 
          <version>${activemq-version}</version> 
        </dependency>
        <!--  This is needed by the camel-jms component -->
        <dependency> 
          <groupId>org.apache.xbean</groupId> 
          <artifactId>xbean-spring</artifactId> 
          <version>${xbean-version}</version> 
        </dependency>
    
      </dependencies>
      ...
    </project>
Comments powered by Disqus