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

Configuring Global Mule Elements

About Global Elements

A global element can serve as a template for configuring a specific type of building block (endpoint, transformer, filter, or cloud connector, for example). Since they are templates — rather than actual building blocks — you can’t insert global elements directly into your application flows. However, you can transfer a global element’s properties to multiple instances of its associated building block type, even if those building block instances are scattered across flows within your project.

Generally, global elements are optional, although in some cases (all cloud connectors, for example), they are obligatory. Whether optional or required, global elements qualify as a "best practice" for the following reasons:

  • Global elements are reusable. You can configure a global element just once, then share that configuration among building blocks of the same type.

  • Global elements provide flexibility. For instance, you can apply a global element exactly as defined. Alternatively, a specific building block instance can enhance this base configuration by modifying it or adding functionality.

  • Global elements help organize and self-document your configuration files, making them much easier to read.

Some building block types, such as Cloud Connectors, require that you set up a global element before you can use an instance of that particular Cloud Connector in your application flow. After you have created this Cloud Connector global element, you reference it through the pull-down list associated with the Config reference attribute on the Cloud Connector Properties pane.

Similarly, when you create certain endpoints (Ajax, JDBC, JMS, SMTP, and File), you must create a corresponding Global Connector. In the case of JMS, you must choose from one of five "flavors" of JMS: ActiveMQ, Custom JMS, JMS, MuleMQ, or WebLogic JMS).

check If you have not configured a global element for a particular building block type, you can, as a convenience, add one from within the building block’s Properties pane. Click the Add button next to the Config reference property field to open a dialog that creates and configures the global element. twitter-dialog Notice, too, that you can also edit an existing global element through its Properties pane. First, click the down arrow to the right of the Config Reference text box, then select a global element from the drop-down list. Next, click the Edit button, which is located next to the Add button.

Creating and Editing Global Elements

When first clicked (assuming you have not yet created any global elements), the Global Elements tab beneath the canvas displays an empty table with three function buttons: Create, Edit, and Delete. When the table is empty, Create is the only operable button.

global-editor2

Click Create to open the Choose Global Type dialog from which you select the type of building block associated with your global element. Click the plus sign to the left of each building block category to find a particular type of building block. Or, use the Filter box narrow your search. The figure below shows the dialog with some categories expanded:

global-editor3

To use the Filter function, start typing a filter string. As you type each letter, the display changes to show potential matches. For example, suppose you wanted to create a global element for one of the array transformers. Start typing array and the dialog immediately shows all possible matches:

global-editor4

Select the specific building block type, then click OK.

The editor opens the Global Element Properties pane (below, left), which closely resembles the Properties pane that appears when you when configure a single File endpoint instance (below, right).

global-editor5

The figure below shows the Global Elements editor table populated with several global elements.

global-editor6

To edit or delete a global element, select it, then click Edit or Delete. The figure above displays the Custom Filter global element. Notice that it is highlighted.

If you wish to remove the highlighted global element immediately, click Delete. You are not asked to confirm the deletion.

Global Element Reference

For additional information on configuring global elements, see the reference page specific to the associated building block. For example, if you are configuring a cloud connector, such as Twitter, see the Twitter Cloud Connector Reference page.