Connecting with Transports and Connectors
This topic provides a brief overview about connectors and transports in general—what they are, how to use them, and even a hint about how can you develop one.
The main purpose of Anypoint connectors is to provide you with an easy way to connect to the thousands of software-as-a-service (SaaS) platforms out there without having to work with transports or dealing with the different protocols that each API uses.
MuleSoft’s goal was to facilitate how connectors are created and for that we have developed a web kit. Connectors essentially Java POJOs that our kit works with and that are converted into fully featured components for Mule ESB.
To use connectors with a Mule flow, you can add them directly to your Mule app like this:
1 2 3 4 5 <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-s3</artifactId> <version>1.0-SNAPSHOT</version> </dependency>
Or you can deploy the JAR produced by our kit into the lib/user folder to share the connector between multiple applications.
Once you have deployed the connector JAR, reference the schema inside your Mule app config. The following is an example for the S3 connector:
1 2 3 4 5 6 7 <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:s3="http://www.mulesoft.org/schema/mule/s3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/s3 http://www.mulesoft.org/schema/mule/s3/1.0/mule-s3.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd">
How to use each connector depends on the specific connector. You can find a list of available connectors in Anypoint Exchange.
Developing a connector is as straightforward as using them. Read more about developing connectors.
While development continues, connectors have not yet reached their full potential, although progress is continually being made. The following are some tasks that you cannot accomplish with connectors.
Request-Reponse Only: Connectors are designed as request-response message processors. So every operation inside a message processor must have a request to generate a response. You cannot use endpoints with them.
Non-Dynamic Instancing: While you can have multiple connectors defined inside your Mule app, and even multiple instances of the same connector, you cannot create new ones inside a flow.
Global Configuration: Connectors can be configured globally only, and that configuration applies to all operations supported by the connector. You cannot override configuration inside a flow.