Cassandra XML and Maven Support - Mule 4

If you manually code a Mule application in XML either from the Studio XML editor or standalone, to get access to a connector, you must:

  • Add the namespace for the connector to your XML flow.

  • Add dependency information to your Maven pom.xml file.

In the Studio visual editor, when you drag a connector from the palette to the canvas, Studio automatically populates the XML code with the connector namespace and schema location.

Add a Namespace for the Connector

If you manually code the Mule application in Studio’s XML editor or another text editor, paste the following into the header of your configuration XML, inside the <mule> tag:

http://www.mulesoft.org/schema/mule/cassandra-db
http://www.mulesoft.org/schema/mule/cassandra-db/current/mule-cassandra-db.xsd

Configure the Maven POM File

The pom.xml is a Maven file that Anypoint Studio generates that contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your pom.xml file to enable access to this connector.

When creating an app manually from the XML, set up the pom.xml for your project:

<repositories>
   <repository>
        <id>mule-ee-releases</id>
        <name>MuleEE Releases Repository</name>
        <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/</url>
    <repository>
        <id>mule-ee-snapshots</id>
        <name>MuleEE Snapshots Repository</name>
        <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots/</url>
    </repository>
</repositories>

This snippet shows a project dependency for a specific version:

<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-cassandradb-connector</artifactId>
  <version>3.1.1</version>
  <classifier>mule-plugin</classifier>
</dependency>

Replace the contents of the <version> tag with the version that corresponds to the connector you are using.

To obtain the most up-to-date pom.xml file information, access the connector in Anypoint Exchange and click Dependency Snippets.

Next

Now that you have completed XML and Maven, you can try out the Examples.