Search in sources :

Example 1 with GroovyCommandMessageProcessor

use of org.springframework.integration.groovy.GroovyCommandMessageProcessor in project spring-integration by spring-projects.

the class GroovyControlBusFactoryBean method createHandler.

@Override
protected MessageHandler createHandler() {
    Binding binding = new ManagedBeansBinding(this.getBeanFactory());
    GroovyCommandMessageProcessor processor = new GroovyCommandMessageProcessor(binding, message -> {
        Map<String, Object> variables = new HashMap<>();
        variables.put("headers", message.getHeaders());
        return variables;
    });
    if (this.customizer != null) {
        processor.setCustomizer(this.customizer);
    }
    if (this.beanClassLoader != null) {
        processor.setBeanClassLoader(this.beanClassLoader);
    }
    if (getBeanFactory() != null) {
        processor.setBeanFactory(getBeanFactory());
    }
    return this.configureHandler(new ServiceActivatingHandler(processor));
}
Also used : Binding(groovy.lang.Binding) HashMap(java.util.HashMap) GroovyCommandMessageProcessor(org.springframework.integration.groovy.GroovyCommandMessageProcessor) ServiceActivatingHandler(org.springframework.integration.handler.ServiceActivatingHandler)

Aggregations

Binding (groovy.lang.Binding)1 HashMap (java.util.HashMap)1 GroovyCommandMessageProcessor (org.springframework.integration.groovy.GroovyCommandMessageProcessor)1 ServiceActivatingHandler (org.springframework.integration.handler.ServiceActivatingHandler)1