You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

Ruby Component Reference


Ruby Component Reference


The Ruby component can be used to enrich interactive web applications. This component provides developers with the facilities to integrate custom scripts into a flow using the Ruby scripting engine. As an example, you can write a custom script using Ruby for an application, save it in a separate file and then configure the Ruby component to reference the file. Or, after placing the Ruby component on the Studio canvas you can type in the script through the Ruby Pattern Properties pane.
JavaScript also allows the developer to configure interceptors and alter the values or references of particular properties in a script. Interceptors are configured to provide additional services to a message as it flows through a component. For example, a developer can configure an interceptor to execute scheduling or logging of a particular event while a message is being processed. The Ruby component also includes a custom interceptor which allows you to configure settings for Spring elements. Use the Advanced tab to access Script Properties, then define the value and reference for a particular property in the script.
When using Ruby, typing-in or appending a script to the component is the only configuration required.


If the application referencing Ruby expects a response, use a request-response endpoint to enable the Ruby component to communicate in a two-way fashion (See: below).


If Ruby is used to simply pass data to the client, the transaction is referred to as one-way. No response is required from the client (See: below).


Refer to the generic [MULETEMP:Script Component Reference] to see how a script works with one-way and request-response endpoints.

General Tab

To configure the Ruby component, from the Message Flow canvas double-click the Ruby icon to open the Pattern Properties pane. Use the General tab to specify the file location of the script or simply type in the script on the script text window. The scripting engine is Ruby.


Panel Description


Defaults to the generic component name. Change the Display Name, which must be alpha-numeric, to reflect the component’s specific role, i.e., Ruby Script Home Page.


Select one of the following ways to reference the script.
Script Text: Type the script the component will load directly into this space.
Script File: Enter the location of the script to be loaded by the component. The file can reside on the classpath or the local file system.

Advanced Tab

Use the Advanced tab to optionally configure interceptors and (depending on the interceptor) enter Spring values. You also have the option to specify script properties, which are key/value pairs used to alter or change properties in the script. See the [MULETEMP:Script Component Reference] page for information on using the advanced tab.


Panel Description

Interceptors Management

Interceptors enable the developer to provide additional services to the component such as the ability to log transactions and the ability to log the time for each transaction. Use the Add Custom Interceptor to create a custom interceptor that can reference Spring objects. The Interceptor Stack enables you to bundle multiple interceptors. Use the Interceptor Stack to apply multiple interceptors on a JavaScript component. The interceptors will be applied in the order defined in the stack.

Script Properties

Configure these parameters to define attribute keys and their associated values. This enables the Ruby component to quickly look up the value associated with a key.

Documentation tab

The Documentation tab lets you add optional descriptive documentation for the Ruby component. Each component has a Documentation tab and optional Description field.


Property Description


Enter all relevant information regarding this Ruby component. This information is displayed in Studio when you hover over the component icon on the Message Flow canvas.

Mule ESB Reference

Refer to the generic [MULETEMP:Script Component Reference] to see how a script works with one-way and request-response endpoints.

For more information see the Mule ESB page Scripting Module.