zhfeng commented on issue #2590:
URL: https://github.com/apache/camel-quarkus/issues/2590#issuecomment-918717544


   @ppalaga I checked tests  with quarkus-amazon-s3 and basically they work 
since the ```S3Client``` could be wired automatically.
   ```
   2021-09-11 00:25:34,837 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] 
(main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
   2021-09-11 00:25:34,886 INFO  [org.apa.cam.mai.BaseMainSupport] (main) 
Auto-configuration summary
   2021-09-11 00:25:34,887 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     
camel.component.aws2-s3.uriEndpointOverride=http://127.0.0.1:33272
   2021-09-11 00:25:34,887 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     
camel.component.aws2-s3.region=us-east-1
   2021-09-11 00:25:34,887 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     
camel.component.aws2-s3.accessKey=xxxxxx
   2021-09-11 00:25:34,887 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     
camel.component.aws2-s3.secretKey=xxxxxx
   2021-09-11 00:25:34,887 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     
camel.component.aws2-s3.overrideEndpoint=true
   2021-09-11 00:25:34,909 INFO  
[org.apa.cam.mai.MainAutowiredLifecycleStrategy] (main) Autowired property: 
amazonS3Client on component: aws2-s3 as exactly one instance of type: 
software.amazon.awssdk.services.s3.S3Client 
(io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_ClientProxy)
 found in the registry
   2021-09-11 00:25:34,919 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] 
(main) Routes startup summary (total:0 started:0)
   2021-09-11 00:25:34,919 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] 
(main) Apache Camel 3.11.1 (camel-1) started in 25ms (build:0ms init:22ms 
start:3ms)
   2021-09-11 00:25:35,024 INFO  [io.quarkus] (main) Quarkus 2.2.1.Final on JVM 
started in 26.188s. Listening on: http://localhost:35685
   2021-09-11 00:25:35,025 INFO  [io.quarkus] (main) Profile test activated. 
   2021-09-11 00:25:35,025 INFO  [io.quarkus] (main) Installed features: 
[amazon-s3, camel-aws2-s3, camel-core, cdi, resteasy, resteasy-jackson, 
resteasy-multipart, smallrye-context-propagation]
   
   ```
   some notes:
   
   1. it needs to add ```quarkus.s3.sync-client.type=apache``` in 
application.properties because we are using 
```software.amazon.awssdk:apache-client```.  And the 
```software.amazon.awssdk:url-connection-client``` is the default one in 
Quarkus.
   2. it needs to inject ```S3Client``` instance explicitly in test.
   ```
   @Inject
   S3Client s3Client;
   ```
   otherwise it throws the exception
   ```
   Caused by: java.lang.IllegalStateException: The S3Client is required but has 
not been detected/configured.
        at 
io.quarkus.amazon.s3.runtime.S3ClientProducer.client(S3ClientProducer.java:28)
        at 
io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_Bean.create(S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_Bean.zig:202)
        at 
io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_Bean.create(S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_Bean.zig:233)
        at 
io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
        at 
io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
        at 
io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
        at 
io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
        at 
io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
        at 
io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:17)
        at 
io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_ClientProxy.arc$delegate(S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_ClientProxy.zig:85)
        at 
io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_ClientProxy.headBucket(S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_ClientProxy.zig:2996)
        at 
org.apache.camel.component.aws2.s3.AWS2S3Endpoint.doStart(AWS2S3Endpoint.java:101)
        at 
org.apache.camel.support.service.BaseService.start(BaseService.java:119)
        at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.deferStartService(AbstractCamelContext.java:1562)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.deferStartService(AbstractCamelContext.java:1539)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.internalAddService(AbstractCamelContext.java:1441)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1383)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1378)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1373)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:946)
        ... 35 more
   ```
   
   So could this be improved in camel-quarkus-aws2-s3  to get the 
```S3Client``` instance before starting the endpoint ?


-- 
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-unsubscr...@camel.apache.org

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


Reply via email to