Contact Us 1-800-596-4880

Develop Applications for CloudHub

When developing applications for deployment to CloudHub, review the following considerations.

Specify an HTTP/HTTPS Host

If you use Anypoint Connector for HTTP (HTTP Connector), define the host address in the CloudHub configuration as 0.0.0.0. CloudHub routes requests from your application domain URL to the endpoint. If you deploy multiple workers, CloudHub load-balances incoming traffic automatically across the workers for you. As your application scales, work loads automatically distribute between your workers.

Provide an External HTTP/HTTPS Port

If your application requires an externally accessible HTTP or HTTPS port to receive messages, trigger events, or expose a web service or user interface, declare the HTTP Listener port using the reserved property ${http.port} or ${https.port}. On CloudHub, port ${http.port} or ${https.port} is assigned automatically by the platform services. Traffic on port 80 to your application domain’s URL is routed to ${http.port} and traffic on port 443 is route to ${https.port}.

To support routing to multiple CloudHub services over this port, you need to configure each with unique paths on the URL that is exposed. For example:

http://0.0.0.0:${http.port}/service/path/one
http://0.0.0.0:${http.port}/service/path/two

Deployment Option Flexibility

To deploy the same Mule application to different deployment targets, such as an on-premises server and CloudHub, see Deploy Mule Applications.

For the key differences between deployment environments, see Deployment Options.

You can define properties and variables for each deployment outside of the application and then reference them from your application. For example, you can define a local value for the variable http.port or https.port. For information, see Configuring Properties.

You can also set these property variables using Runtime Manager or the Anypoint Platform command-line interface.

Avoid HTTP Proxy Settings

In the CloudHub environment, Mule applications access a target HTTP server directly on the internet. In local development environments, the internet is accessible only via an HTTP proxy server.

You can avoid adding proxy settings in the HTTP request configuration in a Mule application by using JVM system properties so that when you deploy the application to CloudHub, you don’t need to change the code.

To do this:

  1. For Mule 4 applications, enter timeout settings on the HTTP request configuration, for example:

    • HTTP Request configuration > General > Connection idle timeout: 30000

    • HTTP Request configuration > Settings > Response timeout: 30000

      Adjust the timeout values to any number greater than 0. A blank or 0 timeout value can cause a connection failure.

  2. Add the following to the local Mule runtime command line. In Anypoint Studio, change the Run Configurations and add the following parameters as one line:

-Dhttp.nonProxyHosts="localhost"\-Dhttps.proxyHost={proxy server ip}\-Dhttps.proxyPort={proxy server port}\-Dhttp.proxyHost={proxy server ip}\-Dhttp.proxyPort={proxy server port}\-Djava.net.useSystemProxies=false\-Dcom.ning.http.client.AsyncHttpClientConfig.useProxySelector=false\-Dcom.ning.http.client.AsyncHttpClientConfig.useProxyProperties=true
Replace {proxy server ip} and {proxy server port} with the actual HTTP proxy server IP address and port number.

Configure Logging

The CloudHub logging service captures all log messages from your application. You can view logs in the Logging tab in the Runtime Manager console. To expose additional information in your logs for diagnostic or audit purposes, use the Logger component.

On CloudHub, after you delete an application, your log data is no longer accessible through the console. CloudHub archives old log data for a limited period of time before it is purged, so you can recover the data if needed. For more information, open a support case at MuleSoft Help Center.

Package Third-Party Libraries

CloudHub provides services in Anypoint Platform that support connecting over different protocols and transforming many data formats. All the standard Mule libraries are included and available to your application. If you need to include another third-party library, you can package that library in the application JAR file. For information, see Introduction to Mule 4: Packaging Applications.

Access Resources Behind the Firewall

When developing an application that needs to access resources from inside your firewall, you can configure Anypoint Virtual Private Cloud (Anypoint VPC) to host your CloudHub workers and configure an IPSec tunnel to access your applications.

Access Third-Party APIs and Services

MuleSoft provides connectors for many third-party applications, such as Salesforce, NetSuite, and Twitter. For information about how to find and use connectors with your application, see the Introduction to Anypoint Connectors. In addition, you can create your own connectors using Anypoint Connector DevKit.

Use Secure Properties

You can flag application properties as secure so that their values are not visible to users at runtime or passed between the server and the console. For information, see Secure Application Properties.