Class GroovyCommandMessageProcessor
java.lang.Object
org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<Object>
org.springframework.integration.groovy.GroovyCommandMessageProcessor
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,MessageProcessor<Object>
,IntegrationPattern
public class GroovyCommandMessageProcessor
extends AbstractScriptExecutingMessageProcessor<Object>
implements IntegrationPattern
- Since:
- 2.0
- Author:
- Dave Syer, Mark Fisher, Oleg Zhurakousky, Artem Bilan, Stefan Reuter, Gary Russell
-
Constructor Summary
ConstructorDescriptionCreates aGroovyCommandMessageProcessor
that will use theDefaultScriptVariableGenerator
.GroovyCommandMessageProcessor
(groovy.lang.Binding binding) Creates aGroovyCommandMessageProcessor
that will use theDefaultScriptVariableGenerator
and providedBinding
.GroovyCommandMessageProcessor
(groovy.lang.Binding binding, ScriptVariableGenerator scriptVariableGenerator) Creates aGroovyCommandMessageProcessor
that will use the providedScriptVariableGenerator
and Binding.GroovyCommandMessageProcessor
(ScriptVariableGenerator scriptVariableGenerator) Creates aGroovyCommandMessageProcessor
that will use the providedScriptVariableGenerator
. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
executeScript
(ScriptSource scriptSource, Map<String, Object> variables) Subclasses must implement this method.protected String
generateScriptName
(Message<?> message) Return a pattern type this component implements.protected ScriptSource
getScriptSource
(Message<?> message) Subclasses must implement this method to create a script source, optionally using the message to locate or create the script.void
setCustomizer
(GroovyObjectCustomizer customizer) Sets aGroovyObjectCustomizer
for this processor.Methods inherited from class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor
getBeanClassLoader, getBeanFactory, getScriptVariableGenerator, processMessage, setBeanClassLoader, setBeanFactory
-
Constructor Details
-
GroovyCommandMessageProcessor
public GroovyCommandMessageProcessor()Creates aGroovyCommandMessageProcessor
that will use theDefaultScriptVariableGenerator
. -
GroovyCommandMessageProcessor
Creates aGroovyCommandMessageProcessor
that will use the providedScriptVariableGenerator
.- Parameters:
scriptVariableGenerator
- The variable generator.
-
GroovyCommandMessageProcessor
public GroovyCommandMessageProcessor(groovy.lang.Binding binding) Creates aGroovyCommandMessageProcessor
that will use theDefaultScriptVariableGenerator
and providedBinding
. Provided 'binding' will be used in theBindingOverwriteGroovyObjectCustomizerDecorator
to overwrite original Groovy Script 'binding'.- Parameters:
binding
- The binding.
-
GroovyCommandMessageProcessor
public GroovyCommandMessageProcessor(groovy.lang.Binding binding, ScriptVariableGenerator scriptVariableGenerator) Creates aGroovyCommandMessageProcessor
that will use the providedScriptVariableGenerator
and Binding. Provided 'binding' will be used in theBindingOverwriteGroovyObjectCustomizerDecorator
to overwrite original Groovy Script 'binding'.- Parameters:
binding
- The binding.scriptVariableGenerator
- The variable generator.
-
-
Method Details
-
setCustomizer
Sets aGroovyObjectCustomizer
for this processor.- Parameters:
customizer
- The customizer.
-
getIntegrationPatternType
Description copied from interface:IntegrationPattern
Return a pattern type this component implements.- Specified by:
getIntegrationPatternType
in interfaceIntegrationPattern
- Returns:
- the
IntegrationPatternType
this component implements.
-
getScriptSource
Description copied from class:AbstractScriptExecutingMessageProcessor
Subclasses must implement this method to create a script source, optionally using the message to locate or create the script.- Specified by:
getScriptSource
in classAbstractScriptExecutingMessageProcessor<Object>
- Parameters:
message
- the message being processed- Returns:
- a ScriptSource to use to create a script
-
executeScript
Description copied from class:AbstractScriptExecutingMessageProcessor
Subclasses must implement this method. In doing so, the execution context for the script should be populated with the provided script variables.- Specified by:
executeScript
in classAbstractScriptExecutingMessageProcessor<Object>
- Parameters:
scriptSource
- The script source.variables
- The variables.- Returns:
- The result of the execution.
-
generateScriptName
-