You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2022/01/07 16:59:13 UTC

[camel-quarkus] 02/02: MllpTest.invalidMessage fails with Camel 3.11.5 in 2.2.x branch #3442

This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 47e74d0cefdfb13a1331484cddd2a8b24d416f49
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Fri Jan 7 12:36:14 2022 +0100

    MllpTest.invalidMessage fails with Camel 3.11.5 in 2.2.x branch #3442
---
 .../component/mllp/deployment/MllpProcessor.java   | 12 +++++++++++
 .../component/mllp/MllpComponentInitializer.java}  | 24 ++++++++++++++--------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java b/extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java
index 054f077..1642e79 100644
--- a/extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java
+++ b/extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java
@@ -16,8 +16,10 @@
  */
 package org.apache.camel.quarkus.component.mllp.deployment;
 
+import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import org.apache.camel.quarkus.component.mllp.MllpComponentInitializer;
 
 class MllpProcessor {
 
@@ -27,4 +29,14 @@ class MllpProcessor {
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
+
+    /**
+     * A workaround for https://github.com/apache/camel-quarkus/issues/3442
+     * Camel 3.11.x specific
+     */
+    @BuildStep
+    public AdditionalBeanBuildItem additionalBeans() {
+        return new AdditionalBeanBuildItem(MllpComponentInitializer.class);
+    }
+
 }
diff --git a/extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java b/extensions/mllp/runtime/src/main/java/org/apache/camel/quarkus/component/mllp/MllpComponentInitializer.java
similarity index 56%
copy from extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java
copy to extensions/mllp/runtime/src/main/java/org/apache/camel/quarkus/component/mllp/MllpComponentInitializer.java
index 054f077..646fea1 100644
--- a/extensions/mllp/deployment/src/main/java/org/apache/camel/quarkus/component/mllp/deployment/MllpProcessor.java
+++ b/extensions/mllp/runtime/src/main/java/org/apache/camel/quarkus/component/mllp/MllpComponentInitializer.java
@@ -14,17 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.mllp.deployment;
+package org.apache.camel.quarkus.component.mllp;
 
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
 
-class MllpProcessor {
+import org.apache.camel.component.mllp.MllpComponent;
+import org.apache.camel.quarkus.core.events.ComponentAddEvent;
 
-    private static final String FEATURE = "camel-mllp";
-
-    @BuildStep
-    FeatureBuildItem feature() {
-        return new FeatureBuildItem(FEATURE);
+/**
+ * A workaround for https://github.com/apache/camel-quarkus/issues/3442
+ * Camel 3.11.x specific
+ */
+@ApplicationScoped
+public class MllpComponentInitializer {
+    public void onComponentAdd(@Observes ComponentAddEvent event) {
+        if (event.getComponent() instanceof MllpComponent) {
+            MllpComponent.setLogPhi(MllpComponent.isLogPhi());
+        }
     }
 }