You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "francescobianca (via GitHub)" <gi...@apache.org> on 2023/05/12 15:40:27 UTC

[GitHub] [camel-quarkus] francescobianca opened a new issue, #4895: Paho MQTT 5 Component Quarkus: using ssl inside native image

francescobianca opened a new issue, #4895:
URL: https://github.com/apache/camel-quarkus/issues/4895

   **[Quarkus Framework]** Hi, I have compiled my image implementing an MQTT Paho5 client developed with Camel connector in JVM mode and it works correctly. The same image compiled with Docker native file gives error:
   
   `org.apache.camel.PropertyBindingException: Error binding property (camel.component.paho-mqtt5.socketFactory=#class:mypackage.MqttSocketFactory) with name: socketFactory on bean: org.apache.camel.component.paho.mqtt5.PahoMqtt5Component@328cbaba with value: #class:mypackage.MqttSocketFactory`
   
   Do you have to set any special configuration to use SSL on native image? The exact same configuration in JVM mode works without any problems.
   


-- 
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.apache.org

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


[GitHub] [camel-quarkus] francescobianca closed issue #4895: Paho MQTT 5 Component Quarkus: using ssl inside native image

Posted by "francescobianca (via GitHub)" <gi...@apache.org>.
francescobianca closed issue #4895: Paho MQTT 5 Component Quarkus: using ssl inside native image
URL: https://github.com/apache/camel-quarkus/issues/4895


-- 
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] francescobianca commented on issue #4895: Paho MQTT 5 Component Quarkus: using ssl inside native image

Posted by "francescobianca (via GitHub)" <gi...@apache.org>.
francescobianca commented on issue #4895:
URL: https://github.com/apache/camel-quarkus/issues/4895#issuecomment-1547337713

   Thank you very much, annotating the class with `@RegisterForReflection` works native compilation!
   
   ```
   @RegisterForReflection
   @Singleton
   @Log4j2
   public class MqttSocketFactory extends SSLSocketFactory {
   ```


-- 
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 issue #4895: Paho MQTT 5 Component Quarkus: using ssl inside native image

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #4895:
URL: https://github.com/apache/camel-quarkus/issues/4895#issuecomment-1545980469

   If you use `#class`, then Camel will use reflection to instantiate the target class. Therefore, you need to provide a hint to the native compiler by annotating `mypackage.MqttSocketFactory` with `@RegisterForReflection`. See the native mode guide for more information:
   
   https://camel.apache.org/camel-quarkus/3.0.x/user-guide/native-mode.html#reflection
   
   You can probably avoid reflection entirely and create a CDI bean producer for the socket factory like:
   
   ```java
   @ApplicationScoped
   public class SocketFactoryProducer {
       @Produces
       @Named("mySocketFactory")
       public SocketFactory createSocketFactory() {
           return new MqttSocketFactory();
       }
   }
   ```
   
   Then the configuration can reference the named bean:
   
   ```
   camel.component.paho-mqtt5.socketFactory=#mySocketFactory
   ```


-- 
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