Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Connector Reference

This document provides reference information about creating connectors.

Prerequisites

In order to develop connectors (and Mule extensions, in general) using Mule DevKit, the following are required:

  • Java JDK 1.6+

  • Maven 3.x

The @Connector Annotation

The class level @Connector annotation indicates that a Java class needs to be processed by DevKit’s Annotation Processor and must be considered a connector.

The @Connector annotation defines the following annotation type element declarations:

Annotation type element Description Required/Optional Default value

name

defines the name of the connector

REQUIRED

 

schemaVersion

the version of the schema that will be generated by the DevKit

OPTIONAL

1.0

namespace

the namespace of the connector

OPTIONAL

+http://www.mulesoft.org/schema/mule/name

schemaLocation+

the location of the schema file that will be written to the spring.schemas file

OPTIONAL

http://www.mulesoft.org/schema/mule/name/schemaVersion/mule-name.xsd 

and

\{\{http://www.mulesoft.org/schema/mule/}}name/current/mule-name.xsd

minMuleVersion

the minimum Mule version for which the connector is to be used. This will be checked in runtime during the initialise phase of the lifecycle.

OPTIONAL

3.2

Mule Version Verification

At runtime, DevKit compares the minMuleVersion annotation parameter value against the version of Mule where it is deployed. This check is done during the Initialisation phase. Where the version of the Mule instance is older than minMuleVersion, the extension fails to initialize and DevKit logs a proper error message.

The goal of this verification is to prevent possible runtime errors when the extension is executed in an older Mule version than the one for which the extension was originally developed.

Restrictions

The following restrictions apply to types annotated with @Connector.

  • cannot be applied to interfaces

  • cannot be applied to final classes

  • cannot be applied to parametrized classes

  • cannot be applied to non-public classes

  • must contain exactly one method annotated with @Connect

  • must contain exactly one method annotated with @Disconnect