Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-16 Thread via GitHub


davsclaus commented on PR #13109:
URL: https://github.com/apache/camel/pull/13109#issuecomment-1949261018

   LGTM


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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-16 Thread via GitHub


lburgazzoli merged PR #13109:
URL: https://github.com/apache/camel/pull/13109


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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-16 Thread via GitHub


lburgazzoli commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1492498349


##
components/camel-qdrant/src/test/java/org/apache/camel/component/qdrant/QdrantDeleteTest.java:
##
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.qdrant;
+
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.Exchange;
+import org.apache.camel.NoSuchHeaderException;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import static io.qdrant.client.ConditionFactory.matchKeyword;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class QdrantDeleteTest extends QdrantTestSupport {
+
+@DisplayName("Tests that trying to delete without passing the action name 
triggers a failure")
+@Test
+public void deleteWithoutRequiredParameters() {
+Exchange result = fluentTemplate.to("qdrant:upsert")

Review Comment:
   done



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-16 Thread via GitHub


aldettinger commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1492462830


##
components/camel-qdrant/src/test/java/org/apache/camel/component/qdrant/QdrantDeleteTest.java:
##
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.qdrant;
+
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.Exchange;
+import org.apache.camel.NoSuchHeaderException;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import static io.qdrant.client.ConditionFactory.matchKeyword;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class QdrantDeleteTest extends QdrantTestSupport {
+
+@DisplayName("Tests that trying to delete without passing the action name 
triggers a failure")
+@Test
+public void deleteWithoutRequiredParameters() {
+Exchange result = fluentTemplate.to("qdrant:upsert")

Review Comment:
   Maybe we use qdrant:delete like other tests ?



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-16 Thread via GitHub


lburgazzoli commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1492453452


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantEndpoint.java:
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.QdrantGrpcClient;
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
+
+/**
+ * Perform operations on the Qdrant Vector Database.
+ */
+@UriEndpoint(
+ firstVersion = "4.5.0",
+ scheme = Qdrant.SCHEME,
+ title = "Qdrant",
+ syntax = "qdrant:collection",
+ producerOnly = true,
+ category = {
+ Category.DATABASE,
+ Category.AI
+ },
+ headersClass = Qdrant.Headers.class)
+public class QdrantEndpoint extends DefaultEndpoint {
+
+@Metadata(required = true)
+@UriPath(description = "The collection Name")
+private final String collection;
+
+@UriParam
+private QdrantConfiguration configuration;
+
+private final Object lock;
+
+private volatile boolean closeClient;
+private volatile QdrantClient client;
+
+public QdrantEndpoint(
+  String endpointUri,
+  Component component,
+  String collection,
+  QdrantConfiguration configuration) {
+
+super(endpointUri, component);
+
+this.collection = collection;
+this.configuration = configuration;
+
+this.lock = new Object();
+}
+
+public QdrantConfiguration getConfiguration() {
+return configuration;
+}
+
+public String getCollection() {
+return collection;
+}
+
+public synchronized QdrantClient getClient() {
+if (this.client == null) {
+synchronized (this.lock) {
+if (this.client == null) {
+this.client = this.configuration.getClient();
+this.closeClient = false;
+
+if (this.client == null) {
+this.client = createClient();
+this.closeClient = true;
+}
+}
+}
+}
+
+return this.client;
+}
+
+@Override
+public Producer createProducer() throws Exception {
+return new QdrantProducer(this);
+}
+
+@Override
+public Consumer createConsumer(Processor processor) throws Exception {
+throw new UnsupportedOperationException("Consumer is not implemented 
for this component");
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStart();

Review Comment:
   done



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-16 Thread via GitHub


aldettinger commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1492450105


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantEndpoint.java:
##
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.QdrantGrpcClient;
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
+
+/**
+ * Perform operations on the Qdrant Vector Database.
+ */
+@UriEndpoint(
+ firstVersion = "4.5.0",
+ scheme = Qdrant.SCHEME,
+ title = "Qdrant",
+ syntax = "qdrant:collection",
+ producerOnly = true,
+ category = {
+ Category.DATABASE,
+ Category.AI
+ },
+ headersClass = Qdrant.Headers.class)
+public class QdrantEndpoint extends DefaultEndpoint {
+
+@Metadata(required = true)
+@UriPath(description = "The collection Name")
+private final String collection;
+
+@UriParam
+private QdrantConfiguration configuration;
+
+private final Object lock;
+
+private volatile boolean closeClient;
+private volatile QdrantClient client;
+
+public QdrantEndpoint(
+  String endpointUri,
+  Component component,
+  String collection,
+  QdrantConfiguration configuration) {
+
+super(endpointUri, component);
+
+this.collection = collection;
+this.configuration = configuration;
+
+this.lock = new Object();
+}
+
+public QdrantConfiguration getConfiguration() {
+return configuration;
+}
+
+public String getCollection() {
+return collection;
+}
+
+public synchronized QdrantClient getClient() {
+if (this.client == null) {
+synchronized (this.lock) {
+if (this.client == null) {
+this.client = this.configuration.getClient();
+this.closeClient = false;
+
+if (this.client == null) {
+this.client = createClient();
+this.closeClient = true;
+}
+}
+}
+}
+
+return this.client;
+}
+
+@Override
+public Producer createProducer() throws Exception {
+return new QdrantProducer(this);
+}
+
+@Override
+public Consumer createConsumer(Processor processor) throws Exception {
+throw new UnsupportedOperationException("Consumer is not implemented 
for this component");
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStart();

Review Comment:
   Might be doStop() ?



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491178619


##
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantContainer.java:
##
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.infra.qdrant.services;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+public class QdrantContainer extends GenericContainer {
+private static final ObjectMapper MAPPER = new ObjectMapper();
+private static final HttpClient HTTP = HttpClient.newHttpClient();
+
+public static final int HTTP_PORT = 6333;
+public static final int GRPC_PORT = 6334;
+
+public QdrantContainer(DockerImageName imageName) {
+super(imageName);
+}
+
+@Override
+protected void configure() {
+super.configure();
+
+withExposedPorts(HTTP_PORT, GRPC_PORT);
+withLogConsumer(new 
Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)));
+waitingFor(Wait.forLogMessage(".*Actix runtime found; starting in 
Actix runtime.*", 1));
+}
+
+public String getGrpcHost() {
+return getHost();
+}
+
+public int getGrpcPort() {
+return getMappedPort(GRPC_PORT);
+}
+
+public String getHttpHost() {
+return getHost();
+}
+
+public int getHttpPort() {
+return getMappedPort(HTTP_PORT);
+}
+
+public HttpResponse put(String path, Map body) 
throws Exception {
+final String reqPath = !path.startsWith("/") ? "/" + path : path;

Review Comment:
   Oh, you're write. Not sure what I was thinking 🤦 



##
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantContainer.java:
##
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.infra.qdrant.services;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+public class QdrantContainer extends GenericContainer {
+private static final ObjectMapper MAPPER = new ObjectMapper();
+private static final HttpClient HTTP = HttpClient.newHttpClient();
+
+public static final int HTTP_PORT = 6333;
+public static final int GRPC_PORT = 6334;
+
+public QdrantContainer(DockerImageName imageName) {
+super(imageName);
+}
+
+@Override
+protected void configure() {
+super.configure();
+
+withExposedPorts(HTTP_PORT, GRPC_PORT);
+withLogConsumer(new 
Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)));
+waitingFor(Wait.f

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491114732


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantProducer.java:
##
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.function.BiConsumer;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.WithPayloadSelectorFactory;
+import io.qdrant.client.WithVectorsSelectorFactory;
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+public class QdrantProducer extends DefaultAsyncProducer {
+private QdrantClient client;
+private ExecutorService executor;
+
+public QdrantProducer(QdrantEndpoint endpoint) {
+super(endpoint);
+}
+
+@Override
+public QdrantEndpoint getEndpoint() {
+return (QdrantEndpoint) super.getEndpoint();
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+
+this.client = getEndpoint().getClient();
+
+this.executor = getCamelContext()
+.getExecutorServiceManager()
+.newSingleThreadExecutor(this, "producer:" + 
getEndpoint().getId());
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStop();
+
+if (this.executor != null) {
+
getCamelContext().getExecutorServiceManager().shutdownNow(this.executor);
+this.executor = null;
+}
+}
+
+@Override
+public boolean process(Exchange exchange, AsyncCallback callback) {
+final Message in = exchange.getMessage();
+final QdrantAction action = in.getHeader(Qdrant.Headers.ACTION, 
QdrantAction.class);
+
+switch (action) {
+case UPSERT:
+return upsert(exchange, callback);
+case RETRIEVE:
+return retrieve(exchange, callback);
+case DELETE:
+return delete(exchange, callback);
+default:
+throw new UnsupportedOperationException("Unsupported action: " 
+ action.name());
+
+}
+}
+
+// ***
+//
+// Actions
+//
+// ***
+
+@SuppressWarnings({ "unchecked" })
+private boolean upsert(Exchange exchange, AsyncCallback callback) {
+final String collection = getEndpoint().getCollection();
+final Message in = exchange.getMessage();
+final Object body = in.getBody();
+
+List points = new ArrayList<>();
+if (body instanceof Points.PointStruct) {
+points.add((Points.PointStruct) body);
+} else if (body instanceof Collection) {
+points.addAll((Collection) body);
+} else {
+exchange.setException(new QdrantActionException(
+QdrantAction.UPSERT,
+"A payload of type PointStruct or Collection 
is expected"));
+
+return true;
+}
+
+Points.UpsertPoints value = Points.UpsertPoints.newBuilder()
+.setCollectionName(collection)
+.addAllPoints(points)
+.setWait(true)
+.build();
+
+call(
+this.client.upsertAsync(value),
+(r, t) -> {
+if (t != null) {
+exchange.setException(new 
QdrantActionException(QdrantAction.UPSERT, t));
+} else {
+in.setHeader(Qdrant.Headers.OPERATION_ID, 
r.getOperationId());
+in.setHeader(Qdrant.Headers.OPERATION_STATUS, 
r.getStatus().name());
+   

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


lburgazzoli commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491109789


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantProducer.java:
##
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.function.BiConsumer;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.WithPayloadSelectorFactory;
+import io.qdrant.client.WithVectorsSelectorFactory;
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+public class QdrantProducer extends DefaultAsyncProducer {
+private QdrantClient client;
+private ExecutorService executor;
+
+public QdrantProducer(QdrantEndpoint endpoint) {
+super(endpoint);
+}
+
+@Override
+public QdrantEndpoint getEndpoint() {
+return (QdrantEndpoint) super.getEndpoint();
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+
+this.client = getEndpoint().getClient();
+
+this.executor = getCamelContext()
+.getExecutorServiceManager()
+.newSingleThreadExecutor(this, "producer:" + 
getEndpoint().getId());
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStop();
+
+if (this.executor != null) {
+
getCamelContext().getExecutorServiceManager().shutdownNow(this.executor);
+this.executor = null;
+}
+}
+
+@Override
+public boolean process(Exchange exchange, AsyncCallback callback) {
+final Message in = exchange.getMessage();
+final QdrantAction action = in.getHeader(Qdrant.Headers.ACTION, 
QdrantAction.class);
+
+switch (action) {
+case UPSERT:
+return upsert(exchange, callback);
+case RETRIEVE:
+return retrieve(exchange, callback);
+case DELETE:
+return delete(exchange, callback);
+default:
+throw new UnsupportedOperationException("Unsupported action: " 
+ action.name());
+
+}
+}
+
+// ***
+//
+// Actions
+//
+// ***
+
+@SuppressWarnings({ "unchecked" })
+private boolean upsert(Exchange exchange, AsyncCallback callback) {
+final String collection = getEndpoint().getCollection();
+final Message in = exchange.getMessage();
+final Object body = in.getBody();
+
+List points = new ArrayList<>();
+if (body instanceof Points.PointStruct) {
+points.add((Points.PointStruct) body);
+} else if (body instanceof Collection) {
+points.addAll((Collection) body);
+} else {
+exchange.setException(new QdrantActionException(
+QdrantAction.UPSERT,
+"A payload of type PointStruct or Collection 
is expected"));
+
+return true;
+}
+
+Points.UpsertPoints value = Points.UpsertPoints.newBuilder()
+.setCollectionName(collection)
+.addAllPoints(points)
+.setWait(true)
+.build();
+
+call(
+this.client.upsertAsync(value),
+(r, t) -> {
+if (t != null) {
+exchange.setException(new 
QdrantActionException(QdrantAction.UPSERT, t));
+} else {
+in.setHeader(Qdrant.Headers.OPERATION_ID, 
r.getOperationId());
+in.setHeader(Qdrant.Headers.OPERATION_STATUS, 
r.getStatus().name());
+   

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


lburgazzoli commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491107798


##
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantContainer.java:
##
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.infra.qdrant.services;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+public class QdrantContainer extends GenericContainer {
+private static final ObjectMapper MAPPER = new ObjectMapper();
+private static final HttpClient HTTP = HttpClient.newHttpClient();
+
+public static final int HTTP_PORT = 6333;
+public static final int GRPC_PORT = 6334;
+
+public QdrantContainer(DockerImageName imageName) {
+super(imageName);
+}
+
+@Override
+protected void configure() {
+super.configure();
+
+withExposedPorts(HTTP_PORT, GRPC_PORT);
+withLogConsumer(new 
Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)));
+waitingFor(Wait.forLogMessage(".*Actix runtime found; starting in 
Actix runtime.*", 1));
+}
+
+public String getGrpcHost() {
+return getHost();
+}
+
+public int getGrpcPort() {
+return getMappedPort(GRPC_PORT);
+}
+
+public String getHttpHost() {
+return getHost();
+}
+
+public int getHttpPort() {
+return getMappedPort(HTTP_PORT);
+}
+
+public HttpResponse put(String path, Map body) 
throws Exception {
+final String reqPath = !path.startsWith("/") ? "/" + path : path;

Review Comment:
   My understading is that `StringHelper.after`, returns the string after the 
given topic, here instead I was to add a '/' if it is not set, so I'm not sure 
to understand the suggestion



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491082803


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantProducer.java:
##
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.function.BiConsumer;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.WithPayloadSelectorFactory;
+import io.qdrant.client.WithVectorsSelectorFactory;
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+public class QdrantProducer extends DefaultAsyncProducer {
+private QdrantClient client;
+private ExecutorService executor;
+
+public QdrantProducer(QdrantEndpoint endpoint) {
+super(endpoint);
+}
+
+@Override
+public QdrantEndpoint getEndpoint() {
+return (QdrantEndpoint) super.getEndpoint();
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+
+this.client = getEndpoint().getClient();
+
+this.executor = getCamelContext()
+.getExecutorServiceManager()
+.newSingleThreadExecutor(this, "producer:" + 
getEndpoint().getId());
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStop();
+
+if (this.executor != null) {
+
getCamelContext().getExecutorServiceManager().shutdownNow(this.executor);
+this.executor = null;
+}
+}
+
+@Override
+public boolean process(Exchange exchange, AsyncCallback callback) {
+final Message in = exchange.getMessage();
+final QdrantAction action = in.getHeader(Qdrant.Headers.ACTION, 
QdrantAction.class);
+
+switch (action) {
+case UPSERT:
+return upsert(exchange, callback);
+case RETRIEVE:
+return retrieve(exchange, callback);
+case DELETE:
+return delete(exchange, callback);
+default:
+throw new UnsupportedOperationException("Unsupported action: " 
+ action.name());
+
+}
+}
+
+// ***
+//
+// Actions
+//
+// ***
+
+@SuppressWarnings({ "unchecked" })
+private boolean upsert(Exchange exchange, AsyncCallback callback) {
+final String collection = getEndpoint().getCollection();
+final Message in = exchange.getMessage();
+final Object body = in.getBody();
+
+List points = new ArrayList<>();
+if (body instanceof Points.PointStruct) {
+points.add((Points.PointStruct) body);
+} else if (body instanceof Collection) {
+points.addAll((Collection) body);
+} else {
+exchange.setException(new QdrantActionException(
+QdrantAction.UPSERT,
+"A payload of type PointStruct or Collection 
is expected"));
+
+return true;
+}
+
+Points.UpsertPoints value = Points.UpsertPoints.newBuilder()
+.setCollectionName(collection)
+.addAllPoints(points)
+.setWait(true)
+.build();
+
+call(
+this.client.upsertAsync(value),
+(r, t) -> {
+if (t != null) {
+exchange.setException(new 
QdrantActionException(QdrantAction.UPSERT, t));
+} else {
+in.setHeader(Qdrant.Headers.OPERATION_ID, 
r.getOperationId());
+in.setHeader(Qdrant.Headers.OPERATION_STATUS, 
r.getStatus().name());
+   

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


oscerd commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491049404


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantProducer.java:
##
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.function.BiConsumer;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.WithPayloadSelectorFactory;
+import io.qdrant.client.WithVectorsSelectorFactory;
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+public class QdrantProducer extends DefaultAsyncProducer {
+private QdrantClient client;
+private ExecutorService executor;
+
+public QdrantProducer(QdrantEndpoint endpoint) {
+super(endpoint);
+}
+
+@Override
+public QdrantEndpoint getEndpoint() {
+return (QdrantEndpoint) super.getEndpoint();
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+
+this.client = getEndpoint().getClient();
+
+this.executor = getCamelContext()
+.getExecutorServiceManager()
+.newSingleThreadExecutor(this, "producer:" + 
getEndpoint().getId());
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStop();
+
+if (this.executor != null) {
+
getCamelContext().getExecutorServiceManager().shutdownNow(this.executor);
+this.executor = null;
+}
+}
+
+@Override
+public boolean process(Exchange exchange, AsyncCallback callback) {
+final Message in = exchange.getMessage();
+final QdrantAction action = in.getHeader(Qdrant.Headers.ACTION, 
QdrantAction.class);
+
+switch (action) {
+case UPSERT:
+return upsert(exchange, callback);
+case RETRIEVE:
+return retrieve(exchange, callback);
+case DELETE:
+return delete(exchange, callback);
+default:
+throw new UnsupportedOperationException("Unsupported action: " 
+ action.name());
+
+}
+}
+
+// ***
+//
+// Actions
+//
+// ***
+
+@SuppressWarnings({ "unchecked" })
+private boolean upsert(Exchange exchange, AsyncCallback callback) {
+final String collection = getEndpoint().getCollection();
+final Message in = exchange.getMessage();
+final Object body = in.getBody();
+
+List points = new ArrayList<>();
+if (body instanceof Points.PointStruct) {
+points.add((Points.PointStruct) body);
+} else if (body instanceof Collection) {
+points.addAll((Collection) body);
+} else {
+exchange.setException(new QdrantActionException(
+QdrantAction.UPSERT,
+"A payload of type PointStruct or Collection 
is expected"));
+
+return true;
+}
+
+Points.UpsertPoints value = Points.UpsertPoints.newBuilder()
+.setCollectionName(collection)
+.addAllPoints(points)
+.setWait(true)
+.build();
+
+call(
+this.client.upsertAsync(value),
+(r, t) -> {
+if (t != null) {
+exchange.setException(new 
QdrantActionException(QdrantAction.UPSERT, t));
+} else {
+in.setHeader(Qdrant.Headers.OPERATION_ID, 
r.getOperationId());
+in.setHeader(Qdrant.Headers.OPERATION_STATUS, 
r.getStatus().name());
+

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1491043736


##
components/camel-qdrant/src/main/java/org/apache/camel/component/qdrant/QdrantProducer.java:
##
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.function.BiConsumer;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.qdrant.client.QdrantClient;
+import io.qdrant.client.WithPayloadSelectorFactory;
+import io.qdrant.client.WithVectorsSelectorFactory;
+import io.qdrant.client.grpc.Points;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+public class QdrantProducer extends DefaultAsyncProducer {
+private QdrantClient client;
+private ExecutorService executor;
+
+public QdrantProducer(QdrantEndpoint endpoint) {
+super(endpoint);
+}
+
+@Override
+public QdrantEndpoint getEndpoint() {
+return (QdrantEndpoint) super.getEndpoint();
+}
+
+@Override
+public void doStart() throws Exception {
+super.doStart();
+
+this.client = getEndpoint().getClient();
+
+this.executor = getCamelContext()
+.getExecutorServiceManager()
+.newSingleThreadExecutor(this, "producer:" + 
getEndpoint().getId());
+}
+
+@Override
+public void doStop() throws Exception {
+super.doStop();
+
+if (this.executor != null) {
+
getCamelContext().getExecutorServiceManager().shutdownNow(this.executor);
+this.executor = null;
+}
+}
+
+@Override
+public boolean process(Exchange exchange, AsyncCallback callback) {
+final Message in = exchange.getMessage();
+final QdrantAction action = in.getHeader(Qdrant.Headers.ACTION, 
QdrantAction.class);
+
+switch (action) {
+case UPSERT:
+return upsert(exchange, callback);
+case RETRIEVE:
+return retrieve(exchange, callback);
+case DELETE:
+return delete(exchange, callback);
+default:
+throw new UnsupportedOperationException("Unsupported action: " 
+ action.name());
+
+}
+}
+
+// ***
+//
+// Actions
+//
+// ***
+
+@SuppressWarnings({ "unchecked" })
+private boolean upsert(Exchange exchange, AsyncCallback callback) {
+final String collection = getEndpoint().getCollection();
+final Message in = exchange.getMessage();
+final Object body = in.getBody();
+
+List points = new ArrayList<>();
+if (body instanceof Points.PointStruct) {
+points.add((Points.PointStruct) body);
+} else if (body instanceof Collection) {
+points.addAll((Collection) body);
+} else {
+exchange.setException(new QdrantActionException(
+QdrantAction.UPSERT,
+"A payload of type PointStruct or Collection 
is expected"));
+
+return true;
+}
+
+Points.UpsertPoints value = Points.UpsertPoints.newBuilder()
+.setCollectionName(collection)
+.addAllPoints(points)
+.setWait(true)
+.build();
+
+call(
+this.client.upsertAsync(value),
+(r, t) -> {
+if (t != null) {
+exchange.setException(new 
QdrantActionException(QdrantAction.UPSERT, t));
+} else {
+in.setHeader(Qdrant.Headers.OPERATION_ID, 
r.getOperationId());
+in.setHeader(Qdrant.Headers.OPERATION_STATUS, 
r.getStatus().name());
+   

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-15 Thread via GitHub


orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1490713034


##
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantContainer.java:
##
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.infra.qdrant.services;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+public class QdrantContainer extends GenericContainer {
+private static final ObjectMapper MAPPER = new ObjectMapper();
+private static final HttpClient HTTP = HttpClient.newHttpClient();
+
+public static final int HTTP_PORT = 6333;
+public static final int GRPC_PORT = 6334;
+
+public QdrantContainer(DockerImageName imageName) {
+super(imageName);
+}
+
+@Override
+protected void configure() {
+super.configure();
+
+withExposedPorts(HTTP_PORT, GRPC_PORT);
+withLogConsumer(new 
Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)));
+waitingFor(Wait.forLogMessage(".*Actix runtime found; starting in 
Actix runtime.*", 1));
+}
+
+public String getGrpcHost() {
+return getHost();
+}
+
+public int getGrpcPort() {
+return getMappedPort(GRPC_PORT);
+}
+
+public String getHttpHost() {
+return getHost();
+}
+
+public int getHttpPort() {
+return getMappedPort(HTTP_PORT);
+}
+
+public HttpResponse put(String path, Map body) 
throws Exception {
+final String reqPath = !path.startsWith("/") ? "/" + path : path;

Review Comment:
   I think you can use `StringHelper.after(path, "/", path)` here. 



##
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/common/QdrantProperties.java:
##
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.infra.qdrant.common;
+
+public class QdrantProperties {
+public static final String INFRA_TYPE = "qdrant";
+public static final String QDRANT_HTTP_HOST = "qdrant.http.host";
+public static final String QDRANT_HTTP_PORT = "qdrant.http.port";
+public static final String QDRANT_GRPC_HOST = "qdrant.grpc.host";
+public static final String QDRANT_GRPC_PORT = "qdrant.grpc.port";
+public static final String QDRANT_API_KEy = "qdrant.apiKey";

Review Comment:
   There's a small typo here `KEy` instead of `KEY`. 



##
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantLocalContainerService.java:
##
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the L

Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-14 Thread via GitHub


lburgazzoli commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1489856137


##
components/camel-qdrant/src/test/java/org/apache/camel/component/qdrant/QdrantTestSupport.java:
##
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.TestInstance;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+
+@Testcontainers
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class QdrantTestSupport extends CamelTestSupport {
+@Container
+public static QdrantContainer QDRANT = new QdrantContainer();

Review Comment:
   @orpiske test-infra module added
   



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-14 Thread via GitHub


lburgazzoli commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1489129708


##
components/camel-qdrant/src/test/java/org/apache/camel/component/qdrant/QdrantTestSupport.java:
##
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.TestInstance;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+
+@Testcontainers
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class QdrantTestSupport extends CamelTestSupport {
+@Container
+public static QdrantContainer QDRANT = new QdrantContainer();

Review Comment:
   yep, this is on the TODO list, will do before marking this pr as ready to 
review



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-14 Thread via GitHub


orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1489119638


##
components/camel-qdrant/src/test/java/org/apache/camel/component/qdrant/QdrantTestSupport.java:
##
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.qdrant;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.TestInstance;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+
+@Testcontainers
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class QdrantTestSupport extends CamelTestSupport {
+@Container
+public static QdrantContainer QDRANT = new QdrantContainer();

Review Comment:
   We should probably create a `test-infra` component for this, as it 
simplifies maintaining it (including watching the code for updated container 
images for CVEs). 
   
   I don't think it needs to be done right now, but we should probably log an 
issue and do it as soon as the PR is merged.



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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-14 Thread via GitHub


orpiske commented on PR #13109:
URL: https://github.com/apache/camel/pull/13109#issuecomment-1943317137

   This is looking pretty cool @lburgazzoli ! 


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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-13 Thread via GitHub


lburgazzoli commented on PR #13109:
URL: https://github.com/apache/camel/pull/13109#issuecomment-1942090292

   This is a test PR to check an odd behavior where a number of file are 
slightly amended (import order, java doc) hwne building locally  


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



Re: [PR] CAMEL-20404: Create a component for Qdrant Vector Database [camel]

2024-02-13 Thread via GitHub


github-actions[bot] commented on PR #13109:
URL: https://github.com/apache/camel/pull/13109#issuecomment-1942088821

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions 
to run
   
   * You can use the command `/component-test (camel-)component-name1 
(camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and 
`test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache 
Camel committers](https://camel.apache.org/community/team/#committers) have 
access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before 
sharing them publicly.


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