Understand Global Elements

7 篇文章 0 订阅

Understand Global Elements 

In Mule, a Global Element is a reusable, “master” building block that you configure once, then reference many times from building blocks within multiple flows. Rather than repeatedly writing the same code to apply the same configuration to multiple building blocks, you can create one global element that details your configurations or transport details. Then, you can instruct any number of building blocks across flows in your Mule application to reference that global element. 


Global elements provide flexibility. 
A building block can apply a global element’s configuration exactly as defined, or can enhance the global configuration with modifications.


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 offer efficiency.
Rather than changing the same configuration multiple times within many building blocks, you can change a configuration once, in the “master”, and Studio applies the changes to all that reference it.

Some building blocks require a reference to a global element. For example, some message sources must reference a global connector element in order to function as a transport. The majority of building blocks, however, use global elements merely as a matter of convienience and efficiency.

You can acess a global element in Mule Studio via the visual editor or the XML editor.

  • In the visual editor, click the Global Elements tab at the base of the canvas to access a list of all global elements in an application (below, left).
  • In the XML editor, scroll to the top of the XML config file to see the global elements configured outside and above all flows in the application (below, right).

Creating a Global Element

Visual Editor

To create a global element in the visual editor, you can use one of two methods:

  • Global Elements Tab— create, edit or delete global elements outside the context of any flow in your application (below, left).
    1. Click the Global Elements tab at the base of the canvas to navigate to a list of the application’s Global Elements.
    2. Click the Create button to add a new global element.
    3. To configure a building block in flow to reference a global element, use the drop-down menu next to the Config Reference field to select a global element from the list of those you have created.

  • In a Building Block— create or edit a global element from within a building block in your flow (below, right). This method offers the convenience of creating and referencing global elements in one step as you build your flow.
    1. Double-click the building block in a flow that you want to reference a global element to open its Pattern Propertiespanel.
    2. Nex to the Config Reference field, click the (plus) icon to create a new global element, or click the small pencil icon to edit an exiting global element.
    3. After you have created (or edited), then saved your global element, Studio automatically applies the config reference, and adds the global element to the list of items on the Global Elements tab.

XML Editor

To create a global element in the XML editor, write its configuration code at the top of your XML config file, above — and outside — any flows within your application.

To configure a building block in flow to reference a global element, add a config-ref: or connector-ref: attribute to the building block.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值