ppalaga commented on a change in pull request #1050: InfluxDB native support 
#1036
URL: https://github.com/apache/camel-quarkus/pull/1050#discussion_r404950245
 
 

 ##########
 File path: 
integration-tests/influxdb/src/main/java/org/apache/camel/quarkus/component/influxdb/it/InfluxdbResource.java
 ##########
 @@ -33,19 +36,28 @@
 
     private static final Logger LOG = Logger.getLogger(InfluxdbResource.class);
 
-    private static final String COMPONENT_INFLUXDB = "influxdb";
+    public static final String INFLUXDB_CONNECTION_PROPERTY = 
"quarkus.influxdb.connection.url";
+    public static final String INFLUXDB_VERSION = "1.7.10";
+
+    private static final String INFLUXDB_CONNECTION = "http://{{"; + 
INFLUXDB_CONNECTION_PROPERTY + "}}/";
+    private static final String INFLUXDB_CONNECTION_NAME = 
"influxDb_connection";
+    private static final String INFLUXDB_ENDPOINT_URL = "influxdb:" + 
INFLUXDB_CONNECTION_NAME;
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
     @Inject
     CamelContext context;
 
-    @Path("/load/component/influxdb")
+    @Path("/ping")
     @GET
     @Produces(MediaType.TEXT_PLAIN)
-    public Response loadComponentInfluxdb() throws Exception {
-        /* This is an autogenerated test */
-        if (context.getComponent(COMPONENT_INFLUXDB) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", 
COMPONENT_INFLUXDB);
-        return Response.status(500, COMPONENT_INFLUXDB + " could not be loaded 
from the Camel context").build();
+    public String pingVersion() throws Exception {
+        InfluxDB influxDB = 
InfluxDBFactory.connect(context.getPropertiesComponent().parseUri(INFLUXDB_CONNECTION));
+        context.getRegistry().bind(INFLUXDB_CONNECTION_NAME, influxDB);
 
 Review comment:
   I think we do not need a new connection for each request. It could be done 
in an CDI event listener, something like
   
   ```
   void onStart(@Observes 
org.apache.camel.quarkus.core.CamelMainEvents.BeforeConfigure ev) {
           InfluxDB influxDB = 
InfluxDBFactory.connect(context.getPropertiesComponent().parseUri(INFLUXDB_CONNECTION));
           context.getRegistry().bind(INFLUXDB_CONNECTION_NAME, influxDB);
       }
   ```
   
   We might perhaps disconnect on `BeforeStop`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to