Create custom notifications inside your flows and exception strategies, as well as manage actions and alerts in your CloudHub instance. Here we show you how to set up custom notifications.
Review the technical reference linked at top to learn how to manage applications and tenancies through the CloudHub connector.
MuleSoft maintains this connector under the Select support policy.
To deploy, start, stop, and update applications as well as send notifications from your application to CloudHub, get the CloudHub connector from Anypoint Exchange.
To access the CloudHub connector from Anypoint Studio, click Help > Install New Software. In Work with, click
Anypoint Connectors Update Site. In the Community category, click CloudHub Connector. If this option is not listed, click Help > Installation Details and see if the connector was previously installed.
Click Next > then Next again > I accept the terms of the license agreement > Finish, and restart Studio.
Add and configure the CloudHub connector according to the basic setup in our Deploy to CloudHub.
In Anypoint Studio, find the CloudHub connector on the right menu and then drag and drop it next to the Set Payload transformer:
Open the configuration for the CloudHub connector. Create a new Connector Configuration for the connector by clicking the plus sign "+":
For this demo, select Basic Authentication configuration, which must be configured with the corresponding Username and Password.
Inherited Token Authentication is a new configuration option that works only when your CloudHub connector’s application is run inside a CloudHub instance. With this approach the connector retrieves the API Token based on the user that created first the application. Note that if the user that created the application is disabled this authentication method will fail.
Enter your credentials into the configuration fields and click OK:
Make sure that you have selected the Create notification operation and set the properties for:
Domain: This should be the domain you set for your application when you first created it following the Deploy to CloudHub tutorial. Note that this is not the complete domain name (myapp.cloudhub.io) but only the application name (myapp)
Message: The message you want your notification to show (e.g. "Your application has been hit"). In the example below, the notification will simply display a "Hello World!" message.
Priority: The type of the notification. By selecting "INFO", your notification will display an informative message while selecting "ERROR" will display a red alert message.
Additional information can be included with the notification by configuring the "Custom Properties" section.
The expected "Custom Properties" format is
Map <String, String>and is typically referenced using a bean or a variable where you have defined that map, for example,
#[flowVars.magicMap], or by defining a map using MEL
At this point, your application is set to be deployed and run. When your domain root is visited, the Create notification operation in the CloudHub connector creates a "Hello World!" notification message for the domain that the application is currently running on.
|If you always want to create notifications on CloudHub, even when running locally, you can use the Create notification operation. This requires you to configure the connector with your username and password.|
NOTE] The "Retrieve Logs" operation is no longer supported - to download logs use CH API or Anypoint CLI.