You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/07/23 11:00:34 UTC

[GitHub] [camel-quarkus] jamesnetherton opened a new pull request #2940: Add native support for transferException

jamesnetherton opened a new pull request #2940:
URL: https://github.com/apache/camel-quarkus/pull/2940


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] jamesnetherton merged pull request #2940: Add native support for transferException

Posted by GitBox <gi...@apache.org>.
jamesnetherton merged pull request #2940:
URL: https://github.com/apache/camel-quarkus/pull/2940


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2940: Add native support for transferException

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2940:
URL: https://github.com/apache/camel-quarkus/pull/2940#discussion_r676538054



##########
File path: tooling/maven-plugin/src/main/resources/doc-templates/extension-doc-page.adoc
##########
@@ -68,6 +68,19 @@ https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
 The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
 `CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.
 [/#if]
+[#if activatesTransferException ]
+
+== transferException option in native mode
+
+To use the `transferException` option in native mode, you must enable support for object serialization. Refer to the xref:user-guide/native-mode.adoc#serialization[native mode user guide]
+for more information.
+
+You will also need to enable serialization for the exception classes that you intend to serialize. For example.
+[source,java]
+----
+@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
+----
+[/#if]

Review comment:
       How elegant!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] jamesnetherton commented on pull request #2940: Add native support for transferException

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on pull request #2940:
URL: https://github.com/apache/camel-quarkus/pull/2940#issuecomment-886636030


   Latest commit adds the suggested documentation tweak to `CamelConfig.java`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2940: Add native support for transferException

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2940:
URL: https://github.com/apache/camel-quarkus/pull/2940#discussion_r676422778



##########
File path: docs/modules/ROOT/pages/user-guide/native-mode.adoc
##########
@@ -113,24 +113,8 @@ quarkus.index-dependency.commons-lang3.artifact-id = commons-lang3
 ----
 
 [[serialization]]
-== Registration for serialization
-
-If serialization support is requested via `quarkus.camel.native.reflection.serialization-enabled`, the following classes are registered for serialization:
-
-* `java.lang.Boolean`
-* `java.lang.Byte`
-* `java.lang.Character`
-* `java.lang.Float`
-* `java.lang.Double`
-* `java.lang.Integer`
-* `java.lang.Long`
-* `java.lang.Number`
-* `java.lang.String`
-* `java.math.BigInteger`
-* `java.util.Date`
-* `java.util.HashMap`
-* `java.util.LinkedHashMap`
-* `org.apache.camel.support.DefaultExchangeHolder`
+== Registering classes for serialization
 
-Users can register more classes using `@RegisterForReflection(serialization = true)`.
+If serialization support is requested via `quarkus.camel.native.reflection.serialization-enabled`, the classes listed in https://github.com/apache/camel-quarkus/blob/main/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSerializationProcessor.java[CamelSerializationProcessor.BASE_SERIALIZATION_CLASSES] are automatically registered for serialization.

Review comment:
       +1, this is better maintainable in the long term.
   
   It would perhaps be worthwhile to do something similar in https://github.com/apache/camel-quarkus/blob/main/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java#L288-L302 
   

##########
File path: extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSerializationProcessor.java
##########
@@ -35,6 +39,36 @@
 
 public class CamelSerializationProcessor {
     private static final Logger LOGGER = LoggerFactory.getLogger(CamelSerializationProcessor.class);
+    private static final String[] BASE_SERIALIZATION_CLASSES = {
+            // JDK classes
+            AbstractCollection.class.getName(),
+            AbstractList.class.getName(),
+            AbstractMap.class.getName(),
+            BigInteger.class.getName(),
+            Boolean.class.getName(),
+            Byte.class.getName(),
+            Character.class.getName(),
+            Collections.EMPTY_LIST.getClass().getName(),
+            Date.class.getName(),
+            Double.class.getName(),
+            Exception.class.getName(),
+            Float.class.getName(),
+            HashMap.class.getName(),
+            Integer.class.getName(),
+            LinkedHashMap.class.getName(),
+            Long.class.getName(),
+            Number.class.getName(),
+            RuntimeException.class.getName(),
+            StackTraceElement.class.getName(),
+            StackTraceElement[].class.getName(),

Review comment:
       Good to know!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org