This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push: new 7736d41 Registered grok patterns in registry via qualified field producers 7736d41 is described below commit 7736d416e0333cb41ce0bbd5652a803ca80a118a Author: aldettinger <aldettin...@gmail.com> AuthorDate: Mon Aug 3 15:42:35 2020 +0200 Registered grok patterns in registry via qualified field producers --- .../apache/camel/quarkus/component/grok/it/GrokRoute.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/integration-tests/grok/src/main/java/org/apache/camel/quarkus/component/grok/it/GrokRoute.java b/integration-tests/grok/src/main/java/org/apache/camel/quarkus/component/grok/it/GrokRoute.java index 68f822c..e810504 100644 --- a/integration-tests/grok/src/main/java/org/apache/camel/quarkus/component/grok/it/GrokRoute.java +++ b/integration-tests/grok/src/main/java/org/apache/camel/quarkus/component/grok/it/GrokRoute.java @@ -17,6 +17,8 @@ package org.apache.camel.quarkus.component.grok.it; import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.inject.Named; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.grok.GrokDataFormat; @@ -26,13 +28,17 @@ import org.apache.camel.spi.DataFormat; @ApplicationScoped public class GrokRoute extends RouteBuilder { + @Produces + @Named("myAnotherCustomPatternBean") + GrokPattern myAnotherCustomPatternBean = new GrokPattern("FOOBAR_WITH_PREFIX_AND_SUFFIX", "-- %{FOOBAR}+ --"); + + @Produces + @Named("myCustomPatternBean") + GrokPattern myCustomPatternBean = new GrokPattern("FOOBAR", "foo|bar"); + @Override public void configure() { - bindToRegistry("myCustomPatternBean", new GrokPattern("FOOBAR", "foo|bar")); - GrokPattern myAnotherCustomPatternBean = new GrokPattern("FOOBAR_WITH_PREFIX_AND_SUFFIX", "-- %{FOOBAR}+ --"); - bindToRegistry("myAnotherCustomPatternBean", myAnotherCustomPatternBean); - from("direct:log").unmarshal().grok("%{COMMONAPACHELOG}").setBody(simple("ip: ${body[4][clientip]}")); from("direct:fooBar").unmarshal().grok("%{FOOBAR_WITH_PREFIX_AND_SUFFIX:fooBar}").setBody(simple("${body[fooBar]}")); from("direct:ip").unmarshal().grok("%{IP:ip}").setBody(simple("${body[0][ip]} -> ${body[3][ip]}"));