Author: Syeda Safiya Rana
CloudHub is a platform for integration and APIs as a service(iPaaS), which is managed via the Runtime Manager console. We deploy all the applications to the cloudHub to make it available publically. There are many ways in which we can deploy applications to the cloud, one of them is using the Maven.
The Mule Maven Plugins integrates packaging and deployment of the mule application. First the mule application is packed into a deployable jar file which can later be deployed to a running mule runtime engine
– Make sure your system has jdk installed.
– Make sure your system has Maven in it.
To check if there is Maven in your system use the following command:
· mvn –v
Lets see a demo of how this works:
So here we will create a mule application in the Anypoint studio that will expose the API to the users and will create an application and domain name in our cloudHub account.
1. Creating an application:
Here we create a simple application which has a listener with the endpoint(/demo) and set some value in the Set Payload and log the payload.
2. Edit the pom.xml file:
When deploying the application to the cloudHub we should make few changes in the configurations of the pom file. We should add inputs like:
-uri: It’s the uri of the Anypoint platform
-username: Your cloudHub username
-password: Your cloudHbb password
-muleVersion: Version used
-applicationName: Name of the application to be deployed
-workers: Number of workers
-environment: The cloudHub environment to which you want to deploy
-workerType: Size of each worker
3. Get the path of the above pom file:
Go to your machine and get to the pom file of that particular application and open the command prompt from there.
4. Maven Clean:
· mvn clean
The Maven Clean Plugin cleans the files and directories generated by Maven during its build.
5. Create the jar file:
· mvn package
This command will create a jar file.
Once the jar is created the application is ready to be deployed.
6. Deploying the application:
· mvn deploy –DmuleDeploy
This command will deploy the application to the cloudHub.
To check if the application is deployed to the cloudHub, you can go to your Runtime Manager and see if your application name is present there and the application has started. To test this you can take the App uri and hit it with your endpoint.
/demo was the endpoint of your application.