You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "anchialas (via GitHub)" <gi...@apache.org> on 2024/09/19 06:59:22 UTC

[I] Auto-Configuration for Camel-Master Service-Selector [camel-quarkus]

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

   ### Bug description
   
   We have multiple Camel-Master Service Providers active in our Quarkus camel app with 
   * Quarkus v3.8.6
   * Camel-Quarkus v3.8.3 
   * Camel v4.4.3
   
   Therefore we would like to replace the default SelectSingle selector [1] with the `SelectByOrder` implementation. For this we use the property `camel.component.master.service-selector`. Since an instance is expected as the value, we have also written a simple converter: 
   ```java
   @Converter
   public class ClusterSelectorConverter {
       @Converter
       public CamelClusterService.Selector convert(String selectorClass) {
           try {
               return (CamelClusterService.Selector)Class.forName(selectorClass).getConstructor().newInstance();
           } catch (Exception ex) {
               throw new IllegalStateException(ex);
           }
       }
   }
   ```
   This all works, but the auto-configuration mechanism [2] takes effect too late: the master component has already been initialized with the default selector [3].
   
   How can the selector be configured “correctly”?
   
   Thank you!
   #
   [1] org.apache.camel.support.cluster.ClusterServiceSelectors#DEFAULT_SELECTOR
   [2] MainHelper.setPropertiesOnTarget:323
   [3] MainHelper.setPropertiesOnTarget:303
   


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


Re: [I] Auto-Configuration for Camel-Master Service-Selector [camel-quarkus]

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

   > How can the selector be configured “correctly”?
   
   You could get a handle on the master component within a CDI observer and use `setServiceSelector` to pass in your custom selector. See example here:
   
   https://camel.apache.org/camel-quarkus/next/user-guide/configuration.html#_cdi


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