All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.mule-scripting.xsd Maven / Gradle / Ivy

The newest version!



    
    

    
        
            The scripting module provides facilities for using scripting languages in Mule. Any scripting languages that supports [JSR-223|http://www.jcp.org/en/jsr/detail?id=223] can be used inside Mule. Scripts can be used as implementations of service components or transformers. Also, scripts can be used for expression evaluations, meaning message routing can be controlled using script evaluations on the current message. You can even configure Mule instances from scripts.
        

        
            Scripting
            Scripting Module
            
            
                h2. Script Context Bindings

                When run inside Mule, scripts have a number of objects available to them in the script context. These are:

                ||Name||Description||
                |log|a logger that can be used to write to Mule's log file.|
                |muleContext|a reference to the MuleContext object.|
                |eventContext| A reference to the eventcontext. This allows you to dispatch events progammatically from your script|
                |message|the current message.|
                |originalPayload|the payload of the current message before any transforms.|
                |payload|the transformed payload of the current message if a transformer is configured on the service. Otherwise this is the same value as _originalPayload_.|
                |src|same as _payload_, kept for backward compatability.|
                |service|a reference to the current service object.|
                |id|the current event id.|
                |result|a placeholder object where the result of the script can be written to. Usually it's better to just return a value from the script unless the script method doesn't have a return value.|
            

            
                h2. Script Configuration Builder (Deprecated, will be removed as of Mule 4.0)

                The {javadoc:mule/module/scripting/builders|ScriptConfigurationBuilder}ScriptConfigurationBuilder{javadoc} allows developers to create a Mule instance from a JSR-223 compliant script. To load the manager from Groovy:

                {code:java}
                ConfigurationBuilder builder = new ScriptConfigurationBuilder("groovy", "../conf/mule-config.groovy");
                MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext(builder);
                {code}

                Or to start the server from the command line:
                {code}
                mule -M-Dorg.mule.script.engine=groovy
                -builder org.mule.module.scripting.builders.ScriptConfigurationBuilder
                -config ../conf/mule-config.groovy
                {code}

                For more information about configuring a Mule instance from code or script see [Configuration Overview].
            
        
    

    
        
            
                Defines a script component backed by a JSR-223 compliant script engine such as Groovy, JavaScript, or Ruby. Scripting allows you to either directly embed your script inside the XML config or reference a script using Spring's dynamic language support: http://static.springframework.org/spring/docs/2.5.x/reference/dynamic-language.html.
            
            
                
                    This example demonstrates how to configure a Groovy Script component with an in-line script.
                

                
                    This example demonstrates how to orchestrate message flows using bindings. The example calls out to two different services and passes the results on to the outbound router.
                
            
        
    
    
        
            
                
                    
                        
                            
                                A script to be executed by a JSR-223 compliant script engine such as Groovy, JavaScript(Rhino), Python, Ruby, or Beanshell.
                            
                        
                    
                    
                        
                            
                                A binding associates a Mule endpoint with an injected Java interface (this is like using Spring to inject a bean, but instead of calling a method on the bean a message is sent to an endpoint). Script bindings will only work with Java-based scripting languages. Right now there is no validation on when languages support Java bindinngs because there are so many scripting languages.
                            
                        
                    
                
                
                    
                        A reference to a script object bean, that is, a {{<script:script ...>}} definition.
                        
                    
                
            
        
    

    
        
            
                Represents a script that can be used as a component for a service or a transformer. The script text can be pulled in from a script file or can be embedded inside this element. A script can be executed by any JSR-223 compliant script engine such as Groovy, JavaScript(Rhino), Python, Ruby, or Beanshell.
            
        
    

    
        
            The script to execute as a service. When run inside Mule, scripts have a number of objects available to them in the script context. These are:
                {html}
                
log a logger that can be used to write to Mule's log file.
muleContext a reference to the MuleContext object.
message the current message.
originalPayload the payload of the current message before any transforms.
payload the transformed payload of the current message if a transformer is configured on the service. Otherwise this is the same value as _originalPayload_.
service a reference to the current service object.
id the current event id.
result a placeholder object where the result of the script can be written. Usually it's better to just return a value from the script unless the script method doesn't have a return value.
{html}
Used for embedding script code inside the XML. This is useful for simple scripts where you are just mocking up a quick application. The name used to identify this script object. This is used when you want to reference this script object from a component or transformer. The name of the script engine being used. All scripting languages that support JSR-223 have a script engine name such as groovy, ruby, python, etc. If this value is not set, but a script file is configured, Mule will attempt to load the correct script engine according to the script file's extension. The script file to load for this object. The file can be on the classpath or local file system.
Runs a script to perform transformation on the current message. A script to be executed by a JSR-223 compliant script engine such as Groovy, JavaScript(Rhino), Python, Ruby, or Beanshell. Runs a script to perform filter on the current message. A script to be executed by a JSR-223 compliant script engine such as Groovy, JavaScript(Rhino), Python, Ruby, or Beanshell. A wrapper for a component object that allows the underlying object to be reloaded at runtime. This makes it possible to hot-deploy new component logic without restarting. The name for this refreshable groovy bean wrapper. The reference to a {{groovy.lang.Groovy}} object to use for this component. The entrypoint method to invoke when a message is received for the object. This element allows the http://www.springframework.org/schema/lang namespace to be embedded. Within this element developers can include the Spring {{lang}} namespace.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy