Rename groovy-transformer to groovy-processor
This can be then used as a comnmon groovy-processor app that can be used in lieu of the current groovy-transform and groovy-filter processor apps.
This commit is contained in:
13
applications/processor/groovy-processor/README.adoc
Normal file
13
applications/processor/groovy-processor/README.adoc
Normal file
@@ -0,0 +1,13 @@
|
||||
//tag::ref-doc[]
|
||||
= Groovy Processor
|
||||
|
||||
A Processor that applies a Groovy script against messages.
|
||||
|
||||
== Options
|
||||
|
||||
The **$$groovy-processor** $$processor$$ has the following options:
|
||||
|
||||
//tag::configuration-properties[]
|
||||
//end::configuration-properties[]
|
||||
|
||||
//end::ref-doc[]
|
||||
@@ -4,8 +4,8 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>groovy-transform-processor</artifactId>
|
||||
<name>groovy-transform-processor</name>
|
||||
<description>groovy-transform processor apps</description>
|
||||
<name>groovy-processor</name>
|
||||
<description>groovy processor apps</description>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
@@ -92,15 +92,15 @@
|
||||
<type>processor</type>
|
||||
<version>${project.version}</version>
|
||||
<configClass>
|
||||
org.springframework.cloud.stream.app.groovy.transform.processor.GroovyTransformProcessorConfiguration.class
|
||||
org.springframework.cloud.stream.app.groovy.processor.GroovyProcessorConfiguration.class
|
||||
</configClass>
|
||||
<functionDefinition>byteArrayTextToString|groovyTransformFunction</functionDefinition>
|
||||
<functionDefinition>byteArrayTextToString|groovyProcessorFunction</functionDefinition>
|
||||
</generatedApp>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud.stream.app</groupId>
|
||||
<artifactId>groovy-transform-processor</artifactId>
|
||||
<artifactId>groovy-processor</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.app.groovy.transform.processor;
|
||||
package org.springframework.cloud.stream.app.groovy.processor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@@ -45,14 +45,14 @@ import org.springframework.util.CollectionUtils;
|
||||
* @author Soby Chacko
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(GroovyTransformProcessorProperties.class)
|
||||
public class GroovyTransformProcessorConfiguration {
|
||||
@EnableConfigurationProperties(GroovyProcessorProperties.class)
|
||||
public class GroovyProcessorConfiguration {
|
||||
|
||||
@Autowired
|
||||
private GroovyTransformProcessorProperties properties;
|
||||
private GroovyProcessorProperties properties;
|
||||
|
||||
@Bean
|
||||
public Function<Message<?>, Object> groovyTransformFunction(ScriptVariableGenerator scriptVariableGenerator) {
|
||||
public Function<Message<?>, Object> groovyProcessorFunction(ScriptVariableGenerator scriptVariableGenerator) {
|
||||
return message -> transformer(scriptVariableGenerator).processMessage(message);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.app.groovy.transform.processor;
|
||||
package org.springframework.cloud.stream.app.groovy.processor;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -29,9 +29,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
*
|
||||
* @author Eric Bottard
|
||||
*/
|
||||
@ConfigurationProperties("groovy-transformer")
|
||||
@ConfigurationProperties("groovy-processor")
|
||||
@Validated
|
||||
public class GroovyTransformProcessorProperties {
|
||||
public class GroovyProcessorProperties {
|
||||
|
||||
/**
|
||||
* Reference to a script used to process messages.
|
||||
@@ -0,0 +1,3 @@
|
||||
configuration-properties.classes=org.springframework.cloud.stream.app.groovy.processor.GroovyProcessorProperties
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.app.groovy.transform.processor;
|
||||
package org.springframework.cloud.stream.app.groovy.processor;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@@ -33,16 +33,16 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class GroovyTransformProcessorIntegrationTests {
|
||||
public class GroovyProcessorIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void testGroovyTransformerWithScript() {
|
||||
public void testGroovyProcessorWithScript() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyTransformTestAppConfiguration.class))
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyProcessorTestAppConfiguration.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyTransformFunction",
|
||||
"--groovy-transformer.script=script.groovy",
|
||||
"--groovy-transformer.variables=limit=5\n foo=\\\40WORLD")) {
|
||||
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyProcessorFunction",
|
||||
"--groovy-processor.script=script.groovy",
|
||||
"--groovy-processor.variables=limit=5\n foo=\\\40WORLD")) {
|
||||
|
||||
InputDestination processorInput = context.getBean(InputDestination.class);
|
||||
OutputDestination processorOutput = context.getBean(OutputDestination.class);
|
||||
@@ -55,12 +55,12 @@ public class GroovyTransformProcessorIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGroovyTransformerWithGrab() {
|
||||
public void testGroovyProcessorWithGrab() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyTransformTestAppConfiguration.class))
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyProcessorTestAppConfiguration.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyTransformFunction",
|
||||
"--groovy-transformer.script=script-with-grab.groovy")) {
|
||||
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyProcessorFunction",
|
||||
"--groovy-processor.script=script-with-grab.groovy")) {
|
||||
|
||||
InputDestination processorInput = context.getBean(InputDestination.class);
|
||||
OutputDestination processorOutput = context.getBean(OutputDestination.class);
|
||||
@@ -74,7 +74,7 @@ public class GroovyTransformProcessorIntegrationTests {
|
||||
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Import({GroovyTransformProcessorConfiguration.class})
|
||||
public static class GroovyTransformTestAppConfiguration {
|
||||
@Import({GroovyProcessorConfiguration.class})
|
||||
public static class GroovyProcessorTestAppConfiguration {
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//tag::ref-doc[]
|
||||
= Groovy Transform Processor
|
||||
|
||||
A Processor that transforms messages using a Groovy script.
|
||||
|
||||
== Options
|
||||
|
||||
The **$$groovy-transform$$** $$processor$$ has the following options:
|
||||
|
||||
//tag::configuration-properties[]
|
||||
//end::configuration-properties[]
|
||||
|
||||
//end::ref-doc[]
|
||||
@@ -1,3 +0,0 @@
|
||||
configuration-properties.classes=org.springframework.cloud.stream.app.groovy.transform.processor.GroovyTransformProcessorProperties
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<modules>
|
||||
<module>bridge-processor</module>
|
||||
<module>groovy-transform-processor</module>
|
||||
<module>groovy-processor</module>
|
||||
<module>header-enricher-processor</module>
|
||||
<module>splitter-processor</module>
|
||||
<module>filter-processor</module>
|
||||
|
||||
Reference in New Issue
Block a user