Class JRubyScriptingContainer

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, DynamicPollingTemplate.TemplateProvider, MessageEventGenerator, Service, StateManagedComponent

    @ComponentProfile(summary="Execute a JRuby script stored on the filesystem/classpath",
                      tag="service,scripting",
                      branchSelector=true)
    public class JRubyScriptingContainer
    extends ServiceImp
    implements DynamicPollingTemplate.TemplateProvider
    Execute a jruby script using JRuby Embed Core Scripting container.

    Rather than making use of the JSR223 bindings where things need to be controlled via system properties; this makes use of ScriptingContainer to execute your jruby scripts which allows more fine-grained control over the behaviour.

    In addition to specifying the script that works on the AdaptrisMessage object; you have the option of specifying scripts that should be executed as each part of the lifecycle phases init(), start(), stop(), close().

    The service-script will executed at runtime and the AdaptrisMessage that is due to be processed is bound as a variable message. All executed scripts will have an instance of org.slf4j.Logger is also bound as log. These can be used as a standard variables within the script though of course you may need additional qualifiers if you specify a different ContainerBuilderImpl.getVariableBehaviour().

    In the adapter configuration file this class is aliased as jruby-scripting-service which is the preferred alternative to the fully qualified classname when building your configuration.