You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mark-bathori (via GitHub)" <gi...@apache.org> on 2025/10/27 14:24:34 UTC

[PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

mark-bathori opened a new pull request, #10467:
URL: https://github.com/apache/nifi/pull/10467

   <!-- 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. -->
   
   # Summary
   
   [NIFI-15145](https://issues.apache.org/jira/browse/NIFI-15145)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [x] Build completed using `./mvnw clean install -P contrib-check`
     - [x] JDK 21
     - [x] JDK 25
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2747481946


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/AbstractCouchbaseService.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseContext;
+import org.apache.nifi.services.couchbase.utils.DocumentType;
+
+import java.util.Set;
+
+public class AbstractCouchbaseService extends AbstractControllerService {
+
+    protected static final String KEY = "key";
+    protected static final Set<String> REQUIRED_KEYS = Set.of(KEY);
+
+    private static final String DEFAULT_BUCKET = "default";
+    private static final String DEFAULT_SCOPE = "_default";
+    private static final String DEFAULT_COLLECTION = "_default";
+
+    protected CouchbaseClient couchbaseClient;

Review Comment:
   The field should be `volatile` and please move it after the static property definitions below.
   Please also fix the same in `AbstractCouchbaseProcessor`.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-couchbase-bundle</artifactId>
+        <version>2.7.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>nifi-couchbase-services</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <!-- Internal dependencies -->
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-couchbase-services-api</artifactId>
+            <version>2.7.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-lookup-service-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-record</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-record-serialization-service-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-json-record-utils</artifactId>
+            <version>2.7.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-avro-record-utils</artifactId>
+            <version>2.7.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-distributed-cache-client-service-api</artifactId>
+            <scope>compile</scope>

Review Comment:
   The service API dependency should be `provided` (no `scope` definition is needed but it can be inherited from dependency management).



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+
+        try {
+            couchbaseClient.replaceDocument(documentId, document);

Review Comment:
   `AtomicDistributedMapCacheClient` interface expects to apply optimistic locking so `AtomicCacheEntry.version` should be passed as the CAS value to Couchbase if it is available.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+
+        try {
+            couchbaseClient.replaceDocument(documentId, document);

Review Comment:
   Though the API specification of the `replace()` method [says](https://github.com/apache/nifi/blob/29d5040714982a57e9d1ca622f6e0479762d5309/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/AtomicDistributedMapCacheClient.java#L54) _"Replace an **existing key** with new value"_, the [only client](https://github.com/apache/nifi/blob/29d5040714982a57e9d1ca622f6e0479762d5309/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/WaitNotifyProtocol.java#L296) of the method expects insert logic as well. So we may consider adding that logic too (as it was in the old implementation). I suggest checking the other `replace()` implementations to get an idea how it should work.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseKeyValueLookupService.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.lookup.LookupFailureException;
+import org.apache.nifi.lookup.StringLookupService;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseLookupInResult;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+@Tags({"lookup", "enrich", "key", "value", "couchbase"})
+@CapabilityDescription("Lookup a string value from Couchbase Server associated with the specified key. The coordinates that are passed to the lookup must contain the key 'key'.")
+public class CouchbaseKeyValueLookupService extends AbstractCouchbaseService implements StringLookupService {
+
+    private volatile String subDocPath;

Review Comment:
   Please move it after the static members.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/AbstractCouchbaseService.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseContext;
+import org.apache.nifi.services.couchbase.utils.DocumentType;
+
+import java.util.Set;
+
+public class AbstractCouchbaseService extends AbstractControllerService {
+
+    protected static final String KEY = "key";
+    protected static final Set<String> REQUIRED_KEYS = Set.of(KEY);
+
+    private static final String DEFAULT_BUCKET = "default";
+    private static final String DEFAULT_SCOPE = "_default";
+    private static final String DEFAULT_COLLECTION = "_default";
+
+    protected CouchbaseClient couchbaseClient;
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    public static final PropertyDescriptor BUCKET_NAME = new PropertyDescriptor.Builder()
+            .name("Bucket Name")
+            .description("The name of the bucket where documents will be stored. Each bucket contains a hierarchy of scopes and collections to group keys and values logically.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_BUCKET)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor SCOPE_NAME = new PropertyDescriptor.Builder()
+            .name("Scope Name")
+            .description("The name of the scope  which is a logical namespace within a bucket, serving to categorize and organize related collections.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_SCOPE)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor COLLECTION_NAME = new PropertyDescriptor.Builder()
+            .name("Collection Name")
+            .description("The name of collection which is a logical container within a scope, used to hold documents.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_COLLECTION)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    @OnEnabled
+    public void onEnabled(final ConfigurationContext context) {
+        final CouchbaseConnectionService connectionService = context.getProperty(COUCHBASE_CONNECTION_SERVICE).asControllerService(CouchbaseConnectionService.class);
+        final CouchbaseContext couchbaseContext = getCouchbaseContext(context);
+        couchbaseClient = connectionService.getClient(couchbaseContext);
+    }
+
+    public Set<String> getRequiredKeys() {
+        return REQUIRED_KEYS;
+    }
+
+    private CouchbaseContext getCouchbaseContext(ConfigurationContext context) {
+        final String bucketName = context.getProperty(BUCKET_NAME).evaluateAttributeExpressions().getValue();
+        final String scopeName = context.getProperty(SCOPE_NAME).evaluateAttributeExpressions().getValue();
+        final String collectionName = context.getProperty(COLLECTION_NAME).evaluateAttributeExpressions().getValue();
+
+        return new CouchbaseContext(bucketName, scopeName, collectionName, DocumentType.JSON);

Review Comment:
   Due to the fixed document type, `CouchbaseKeyValueLookupService` and `CouchbaseMapCacheClient` can only handle Json documents. They should also be able to process binary (raw) type too.



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2748109111


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+
+        try {
+            couchbaseClient.replaceDocument(documentId, document);
+            return true;
+        } catch (CouchbaseException e) {
+            return false;
+        }
+    }
+
+    @Override
+    public <K, V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        final byte[] document = serializeDocument(value, valueSerializer);
+
+        try {
+            couchbaseClient.insertDocument(documentId, document);
+            return true;
+        } catch (CouchbaseException e) {
+            return false;
+        }
+    }
+
+    @Override
+    public <K, V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException {
+        if (containsKey(key, keySerializer)) {
+            return get(key, keySerializer, valueDeserializer);
+        }

Review Comment:
   The cache entry can be deleted or expired after `containsKey()` and `get()` may return `null`. So it would be more error-proof to just call `get()` and return if something is found.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {

Review Comment:
   Only `DocumentNotFoundException` should be handled gracefully. Other exceptions should be wrapped into `IOException` and thrown.
   
   Similarly: `replace()`, `remove()`, `get()`
   
   `DocumentExistsException`: `putIfAbsent()`



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+
+        try {
+            couchbaseClient.replaceDocument(documentId, document);
+            return true;
+        } catch (CouchbaseException e) {
+            return false;
+        }
+    }
+
+    @Override
+    public <K, V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        final byte[] document = serializeDocument(value, valueSerializer);
+
+        try {
+            couchbaseClient.insertDocument(documentId, document);
+            return true;
+        } catch (CouchbaseException e) {
+            return false;
+        }
+    }
+
+    @Override
+    public <K, V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException {
+        if (containsKey(key, keySerializer)) {
+            return get(key, keySerializer, valueDeserializer);
+        }
+
+        put(key, value, keySerializer, valueSerializer);

Review Comment:
   Based on the method name shouldn't it be `putIfAbsent()`?



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-standard-services/src/main/java/org/apache/nifi/services/couchbase/StandardCouchbaseClient.java:
##########
@@ -141,6 +152,76 @@ public CouchbaseUpsertResult upsertDocument(String documentId, byte[] content) t
         }
     }
 
+    @Override
+    public boolean documentExists(String documentId) throws CouchbaseException {
+        try {
+            final ExistsResult result = collection.exists(documentId);
+            return result.exists();
+        } catch (Exception e) {
+            throw new CouchbaseException("Failed to check document [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public void insertDocument(String documentId, byte[] content) throws CouchbaseException {
+        if (!getInputValidator(documentType).test(content)) {
+            throw new CouchbaseException("The provided input is invalid for document [%s]".formatted(documentId));
+        }
+
+        try {
+            collection.insert(documentId, content,
+                    InsertOptions.insertOptions()
+                            .durability(persistTo, replicateTo)
+                            .transcoder(getTranscoder(documentType))
+                            .clientContext(new HashMap<>()));
+        } catch (Exception e) {
+            throw new CouchbaseException("Failed to insert document [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public void removeDocument(String documentId) throws CouchbaseException {
+        try {
+            collection.remove(documentId);
+        } catch (Exception e) {
+            throw new CouchbaseException("Failed to remove document [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public void replaceDocument(String documentId, byte[] content) throws CouchbaseException {
+        if (!getInputValidator(documentType).test(content)) {
+            throw new CouchbaseException("The provided input is invalid for document [%s]".formatted(documentId));
+        }
+
+        try {
+            collection.replace(documentId, content,
+                    ReplaceOptions.replaceOptions()
+                            .durability(persistTo, replicateTo)
+                            .transcoder(getTranscoder(documentType))
+                            .clientContext(new HashMap<>()));
+        } catch (Exception e) {
+            throw new CouchbaseException("Failed to replace document [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public CouchbaseLookupInResult lookUpIn(String documentId, String subDocPath) throws CouchbaseException {

Review Comment:
   Based on the Couchbase Java client type and method names, the correct spelling would be: `lookupIn()`



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "mark-bathori (via GitHub)" <gi...@apache.org>.
mark-bathori commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2765384281


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+
+        try {
+            couchbaseClient.replaceDocument(documentId, document);

Review Comment:
   I also find this conflicting. The AtomicDistributedMapCacheClient documentation explicitly states that 'if the revision does not match with the one in the cache storage, value will not be replaced' and that the method returns 'true only if the key is replaced.'
   However, despite this, the legacy implementation includes an insert step, as you noted. I am unsure whether we should correct this to strictly follow the documentation or maintain the existing (potentially incorrect) behavior.



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2821756986


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,208 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseCasMismatchException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocExistsException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocNotFoundException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Optional;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseDocNotFoundException e) {
+            return null;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to fetch cache entry [%s] from Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+        final Optional<Long> revision = entry.getRevision();
+
+        if (revision.isEmpty()) {
+            try {
+                couchbaseClient.insertDocument(documentId, document);
+                return true;
+            } catch (CouchbaseDocExistsException e) {
+                return false;
+            } catch (CouchbaseException e) {
+                throw new IOException("Failed to insert cache entry [%s] into Couchbase".formatted(documentId), e);
+            }
+        }
+
+        try {
+            final long casValue = revision.get();
+            couchbaseClient.replaceDocument(documentId, document, casValue);
+            return true;
+        } catch (CouchbaseDocNotFoundException | CouchbaseCasMismatchException e) {
+            return false;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to replace cache entry [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        final byte[] document = serializeDocument(value, valueSerializer);
+
+        try {
+            couchbaseClient.insertDocument(documentId, document);
+            return true;
+        } catch (CouchbaseDocExistsException e) {
+            return false;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to insert cache entry [%s] into Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final V document = get(key, keySerializer, valueDeserializer);
+        if (document != null) {
+            return document;
+        }
+
+        boolean putResult = putIfAbsent(key, value, keySerializer, valueSerializer);
+        if (!putResult) {
+            getAndPutIfAbsent(key, value, keySerializer, valueSerializer, valueDeserializer);
+        }
+        return null;

Review Comment:
   The result of the recursive call must be returned. Otherwise it will fall back to `null`, even if the recursive call successfully finds the cached item.
   
   ```suggestion
           boolean putResult = putIfAbsent(key, value, keySerializer, valueSerializer);
           if (!putResult) {
               return getAndPutIfAbsent(key, value, keySerializer, valueSerializer, valueDeserializer);
           }
           return null;
   ```



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "deniswsrosa (via GitHub)" <gi...@apache.org>.
deniswsrosa commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3555303709

   any updates on when this PR will be reviewed?


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory merged PR #10467:
URL: https://github.com/apache/nifi/pull/10467


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3861692750

   > Will the project pom.xml (not the bundle ones) be updated to include couchbase connector into nifi as part of this PR or as a separate change?
   
   The Couchbase NAR is rather large, given the extensive shaded content of the client library. For this reason, it is not included in the standard `nifi-assembly` binary.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2764664237


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/AbstractCouchbaseService.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseContext;
+import org.apache.nifi.services.couchbase.utils.DocumentType;
+
+import java.util.Set;
+
+public class AbstractCouchbaseService extends AbstractControllerService {
+
+    protected static final String KEY = "key";
+    protected static final Set<String> REQUIRED_KEYS = Set.of(KEY);
+
+    private static final String DEFAULT_BUCKET = "default";
+    private static final String DEFAULT_SCOPE = "_default";
+    private static final String DEFAULT_COLLECTION = "_default";
+
+    protected CouchbaseClient couchbaseClient;
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    public static final PropertyDescriptor BUCKET_NAME = new PropertyDescriptor.Builder()
+            .name("Bucket Name")
+            .description("The name of the bucket where documents will be stored. Each bucket contains a hierarchy of scopes and collections to group keys and values logically.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_BUCKET)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor SCOPE_NAME = new PropertyDescriptor.Builder()
+            .name("Scope Name")
+            .description("The name of the scope  which is a logical namespace within a bucket, serving to categorize and organize related collections.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_SCOPE)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor COLLECTION_NAME = new PropertyDescriptor.Builder()
+            .name("Collection Name")
+            .description("The name of collection which is a logical container within a scope, used to hold documents.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_COLLECTION)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    @OnEnabled
+    public void onEnabled(final ConfigurationContext context) {
+        final CouchbaseConnectionService connectionService = context.getProperty(COUCHBASE_CONNECTION_SERVICE).asControllerService(CouchbaseConnectionService.class);
+        final CouchbaseContext couchbaseContext = getCouchbaseContext(context);
+        couchbaseClient = connectionService.getClient(couchbaseContext);
+    }
+
+    public Set<String> getRequiredKeys() {
+        return REQUIRED_KEYS;
+    }
+
+    private CouchbaseContext getCouchbaseContext(ConfigurationContext context) {
+        final String bucketName = context.getProperty(BUCKET_NAME).evaluateAttributeExpressions().getValue();
+        final String scopeName = context.getProperty(SCOPE_NAME).evaluateAttributeExpressions().getValue();
+        final String collectionName = context.getProperty(COLLECTION_NAME).evaluateAttributeExpressions().getValue();
+
+        return new CouchbaseContext(bucketName, scopeName, collectionName, DocumentType.JSON);

Review Comment:
   @mark-bathori I believe raw (non-json) string data is valid. `CouchbaseRecordLookupService` really needs Json but `Lookup Sub-Document Path` is optional in `CouchbaseKeyValueLookupService`. `DistributedMapCacheClient` implementations should also be able to handle plain strings.



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "mark-bathori (via GitHub)" <gi...@apache.org>.
mark-bathori commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2765399202


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/AbstractCouchbaseService.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseContext;
+import org.apache.nifi.services.couchbase.utils.DocumentType;
+
+import java.util.Set;
+
+public class AbstractCouchbaseService extends AbstractControllerService {
+
+    protected static final String KEY = "key";
+    protected static final Set<String> REQUIRED_KEYS = Set.of(KEY);
+
+    private static final String DEFAULT_BUCKET = "default";
+    private static final String DEFAULT_SCOPE = "_default";
+    private static final String DEFAULT_COLLECTION = "_default";
+
+    protected CouchbaseClient couchbaseClient;
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    public static final PropertyDescriptor BUCKET_NAME = new PropertyDescriptor.Builder()
+            .name("Bucket Name")
+            .description("The name of the bucket where documents will be stored. Each bucket contains a hierarchy of scopes and collections to group keys and values logically.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_BUCKET)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor SCOPE_NAME = new PropertyDescriptor.Builder()
+            .name("Scope Name")
+            .description("The name of the scope  which is a logical namespace within a bucket, serving to categorize and organize related collections.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_SCOPE)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor COLLECTION_NAME = new PropertyDescriptor.Builder()
+            .name("Collection Name")
+            .description("The name of collection which is a logical container within a scope, used to hold documents.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_COLLECTION)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    @OnEnabled
+    public void onEnabled(final ConfigurationContext context) {
+        final CouchbaseConnectionService connectionService = context.getProperty(COUCHBASE_CONNECTION_SERVICE).asControllerService(CouchbaseConnectionService.class);
+        final CouchbaseContext couchbaseContext = getCouchbaseContext(context);
+        couchbaseClient = connectionService.getClient(couchbaseContext);
+    }
+
+    public Set<String> getRequiredKeys() {
+        return REQUIRED_KEYS;
+    }
+
+    private CouchbaseContext getCouchbaseContext(ConfigurationContext context) {
+        final String bucketName = context.getProperty(BUCKET_NAME).evaluateAttributeExpressions().getValue();
+        final String scopeName = context.getProperty(SCOPE_NAME).evaluateAttributeExpressions().getValue();
+        final String collectionName = context.getProperty(COLLECTION_NAME).evaluateAttributeExpressions().getValue();
+
+        return new CouchbaseContext(bucketName, scopeName, collectionName, DocumentType.JSON);

Review Comment:
   thanks for your insight. I'll add the Binary type support for the new services.



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "mark-bathori (via GitHub)" <gi...@apache.org>.
mark-bathori commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2764399030


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/AbstractCouchbaseService.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseContext;
+import org.apache.nifi.services.couchbase.utils.DocumentType;
+
+import java.util.Set;
+
+public class AbstractCouchbaseService extends AbstractControllerService {
+
+    protected static final String KEY = "key";
+    protected static final Set<String> REQUIRED_KEYS = Set.of(KEY);
+
+    private static final String DEFAULT_BUCKET = "default";
+    private static final String DEFAULT_SCOPE = "_default";
+    private static final String DEFAULT_COLLECTION = "_default";
+
+    protected CouchbaseClient couchbaseClient;
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    public static final PropertyDescriptor BUCKET_NAME = new PropertyDescriptor.Builder()
+            .name("Bucket Name")
+            .description("The name of the bucket where documents will be stored. Each bucket contains a hierarchy of scopes and collections to group keys and values logically.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_BUCKET)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor SCOPE_NAME = new PropertyDescriptor.Builder()
+            .name("Scope Name")
+            .description("The name of the scope  which is a logical namespace within a bucket, serving to categorize and organize related collections.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_SCOPE)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor COLLECTION_NAME = new PropertyDescriptor.Builder()
+            .name("Collection Name")
+            .description("The name of collection which is a logical container within a scope, used to hold documents.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_COLLECTION)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    @OnEnabled
+    public void onEnabled(final ConfigurationContext context) {
+        final CouchbaseConnectionService connectionService = context.getProperty(COUCHBASE_CONNECTION_SERVICE).asControllerService(CouchbaseConnectionService.class);
+        final CouchbaseContext couchbaseContext = getCouchbaseContext(context);
+        couchbaseClient = connectionService.getClient(couchbaseContext);
+    }
+
+    public Set<String> getRequiredKeys() {
+        return REQUIRED_KEYS;
+    }
+
+    private CouchbaseContext getCouchbaseContext(ConfigurationContext context) {
+        final String bucketName = context.getProperty(BUCKET_NAME).evaluateAttributeExpressions().getValue();
+        final String scopeName = context.getProperty(SCOPE_NAME).evaluateAttributeExpressions().getValue();
+        final String collectionName = context.getProperty(COLLECTION_NAME).evaluateAttributeExpressions().getValue();
+
+        return new CouchbaseContext(bucketName, scopeName, collectionName, DocumentType.JSON);

Review Comment:
   I have only added support for JSON, as using binary types with the current supporting services does not seem practical.
   
   The CouchbaseRecordLookupService needs to return a Record type.
   The CouchbaseKeyValueLookupService requires a structured path to perform lookups within the document.
   I am unsure if using the CouchbaseMapCacheClient to cache binary data is a valid scenario. However, I am open to adding binary support if you see a specific use case for it.



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3926986546

   Thanks for the work on this @mark-bathori, and thanks for asking @turcsanyip.
   
   I will take a quick review soon, but I do notice that some commits on the branch are not signed. Given the current state of review, it seems like a good time to squash existing commits into one so it can be signed to meet the merge requirements.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "chedim (via GitHub)" <gi...@apache.org>.
chedim commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3872187877

   So, users would have to build it manually? Asking because I have to write a tutorial for our site about CB+Nifi and how to use it and, if its not in the assembly then I have this question on what would be the best way for people to install it? Would they have to download the sources, build the nar and install it as a plugin?
   
   Ty.
   
   > > Will the project pom.xml (not the bundle ones) be updated to include couchbase connector into nifi as part of this PR or as a separate change?
   > 
   > The Couchbase NAR is rather large, given the extensive shaded content of the client library. For this reason, it is not included in the standard `nifi-assembly` binary.
   
   


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3760097515

   @deniswsrosa The PR has been abandoned due to lack of reviewers. I'm reviewing it now and it should be merged soon.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "deniswsrosa (via GitHub)" <gi...@apache.org>.
deniswsrosa commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3823529407

   @exceptionfactory @turcsanyip We could push another PR with the changes requested in this PR if needed.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3872776136

   > So, users would have to build it manually? Asking because I have to write a tutorial for our site about CB+Nifi and how to use it and, if its not in the assembly then I have this question on what would be the best way for people to install it? Would they have to download the sources, build the nar and install it as a plugin?
   > 
   > Ty.
   > 
   > > > Will the project pom.xml (not the bundle ones) be updated to include couchbase connector into nifi as part of this PR or as a separate change?
   > > 
   > > 
   > > The Couchbase NAR is rather large, given the extensive shaded content of the client library. For this reason, it is not included in the standard `nifi-assembly` binary.
   
   All project NAR files are published to Maven Central through the Apache Nexus Repository as part of the standard release process. This allows anyone to download the NAR, without having to build from source, but does require placing the NAR in an extensions directory that NiFi can read.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "chedim (via GitHub)" <gi...@apache.org>.
chedim commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3898388145

   Ah, thank you for clarifying, @exceptionfactory 


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "mark-bathori (via GitHub)" <gi...@apache.org>.
mark-bathori commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3835068313

   Thanks @turcsanyip for the review. I'll go through your comments and make the requested changes.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2764664237


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/AbstractCouchbaseService.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseContext;
+import org.apache.nifi.services.couchbase.utils.DocumentType;
+
+import java.util.Set;
+
+public class AbstractCouchbaseService extends AbstractControllerService {
+
+    protected static final String KEY = "key";
+    protected static final Set<String> REQUIRED_KEYS = Set.of(KEY);
+
+    private static final String DEFAULT_BUCKET = "default";
+    private static final String DEFAULT_SCOPE = "_default";
+    private static final String DEFAULT_COLLECTION = "_default";
+
+    protected CouchbaseClient couchbaseClient;
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    public static final PropertyDescriptor BUCKET_NAME = new PropertyDescriptor.Builder()
+            .name("Bucket Name")
+            .description("The name of the bucket where documents will be stored. Each bucket contains a hierarchy of scopes and collections to group keys and values logically.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_BUCKET)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor SCOPE_NAME = new PropertyDescriptor.Builder()
+            .name("Scope Name")
+            .description("The name of the scope  which is a logical namespace within a bucket, serving to categorize and organize related collections.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_SCOPE)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    public static final PropertyDescriptor COLLECTION_NAME = new PropertyDescriptor.Builder()
+            .name("Collection Name")
+            .description("The name of collection which is a logical container within a scope, used to hold documents.")
+            .required(true)
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .defaultValue(DEFAULT_COLLECTION)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    @OnEnabled
+    public void onEnabled(final ConfigurationContext context) {
+        final CouchbaseConnectionService connectionService = context.getProperty(COUCHBASE_CONNECTION_SERVICE).asControllerService(CouchbaseConnectionService.class);
+        final CouchbaseContext couchbaseContext = getCouchbaseContext(context);
+        couchbaseClient = connectionService.getClient(couchbaseContext);
+    }
+
+    public Set<String> getRequiredKeys() {
+        return REQUIRED_KEYS;
+    }
+
+    private CouchbaseContext getCouchbaseContext(ConfigurationContext context) {
+        final String bucketName = context.getProperty(BUCKET_NAME).evaluateAttributeExpressions().getValue();
+        final String scopeName = context.getProperty(SCOPE_NAME).evaluateAttributeExpressions().getValue();
+        final String collectionName = context.getProperty(COLLECTION_NAME).evaluateAttributeExpressions().getValue();
+
+        return new CouchbaseContext(bucketName, scopeName, collectionName, DocumentType.JSON);

Review Comment:
   @mark-bathori I believe raw (non-json) string data is valid. `CouchbaseRecordLookupService` really needs Json but `Lookup Sub-Document Path` is optional in `CouchbaseKeyValueLookupService`. `DistributedMapCacheClient` should also be able to handle plain strings.



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #10467:
URL: https://github.com/apache/nifi/pull/10467#discussion_r2817418539


##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseCasMismatchException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocExistsException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocNotFoundException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Optional;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseDocNotFoundException e) {
+            return null;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to fetch cache entry [%s] from Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+        final Optional<Long> revision = entry.getRevision();
+
+        if (revision.isEmpty()) {
+            try {
+                couchbaseClient.insertDocument(documentId, document);
+                return true;
+            } catch (CouchbaseDocExistsException e) {
+                return false;
+            } catch (CouchbaseException e) {
+                throw new IOException("Failed to insert cache entry [%s] into Couchbase".formatted(documentId), e);
+            }
+        }
+
+        try {
+            final long casValue = revision.get();
+            couchbaseClient.replaceDocument(documentId, document, casValue);
+            return true;
+        } catch (CouchbaseDocNotFoundException | CouchbaseCasMismatchException e) {
+            return false;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to replace cache entry [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        final byte[] document = serializeDocument(value, valueSerializer);
+
+        try {
+            couchbaseClient.insertDocument(documentId, document);
+            return true;
+        } catch (CouchbaseDocExistsException e) {
+            return false;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to insert cache entry [%s] into Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final V document = get(key, keySerializer, valueDeserializer);
+        if (document != null) {
+            return document;
+        }
+
+        putIfAbsent(key, value, keySerializer, valueSerializer);
+        return value;

Review Comment:
   The method should return `null` if the key did not exist in the cache and has been inserted during this call.
   
   The method's [API doc](https://github.com/apache/nifi/blob/da8661d5ba4128a74a1a0a68937ad752c984ef09/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java#L70-L76) is not straightforward but the way the callers use `getAndPutIfAbsent()` ([PutDistributedMapCache](https://github.com/apache/nifi/blob/da8661d5ba4128a74a1a0a68937ad752c984ef09/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDistributedMapCache.java#L198-L200), [DetectDuplicate](https://github.com/apache/nifi/blob/da8661d5ba4128a74a1a0a68937ad752c984ef09/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DetectDuplicate.java#L177-L183)) proves that the correct logic should be:
   
   - if the key exists in the cache => no update, return the value
   - if the key not exists in the cache => insert, return null



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseKeyValueLookupService.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.lookup.LookupFailureException;
+import org.apache.nifi.lookup.StringLookupService;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.services.couchbase.utils.CouchbaseLookupInResult;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+@Tags({"lookup", "enrich", "key", "value", "couchbase"})
+@CapabilityDescription("Lookup a string value from Couchbase Server associated with the specified key. The coordinates that are passed to the lookup must contain the key 'key'.")
+public class CouchbaseKeyValueLookupService extends AbstractCouchbaseService implements StringLookupService {
+
+    public static final PropertyDescriptor LOOKUP_SUB_DOC_PATH = new PropertyDescriptor.Builder()
+            .name("Lookup Sub-Document Path")
+            .description("The Sub-Document lookup path within the target JSON document.")
+            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+            .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME,
+            LOOKUP_SUB_DOC_PATH
+    );
+
+    private volatile String subDocPath;
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    @OnEnabled
+    public void onEnabled(final ConfigurationContext context) {
+        super.onEnabled(context);
+        subDocPath = context.getProperty(LOOKUP_SUB_DOC_PATH).evaluateAttributeExpressions().getValue();
+    }
+
+    @Override
+    public Optional<String> lookup(Map<String, Object> coordinates) throws LookupFailureException {
+        final Object documentId = coordinates.get(KEY);
+
+        if (documentId == null) {
+            return Optional.empty();
+        }
+        try {
+            final CouchbaseLookupInResult result = couchbaseClient.lookupIn(documentId.toString(), subDocPath);
+            return Optional.ofNullable(result.resultContent()).map(Object::toString);
+        } catch (Exception e) {
+            throw new LookupFailureException("Key-value lookup from Couchbase failed", e);
+        }

Review Comment:
   `LookupService.lookup()` should return `Optional.empty()` if the key is not found (instead of throwing an exception).
   The [API doc](https://github.com/apache/nifi/blob/da8661d5ba4128a74a1a0a68937ad752c984ef09/nifi-extension-bundles/nifi-standard-services/nifi-lookup-service-api/src/main/java/org/apache/nifi/lookup/LookupService.java#L28-L36) is not really clear but the `Optional` return type indicates the intent. Also, `LookupAttribute` processor should transfer a non-existing key to the `unmatched` relationship but now it goes to `failure` due to the exception.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/test/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClientTest.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocNotFoundException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+import org.apache.nifi.services.couchbase.utils.CouchbaseUpsertResult;
+import org.apache.nifi.util.MockConfigurationContext;
+import org.apache.nifi.util.MockControllerServiceInitializationContext;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.nifi.services.couchbase.AbstractCouchbaseService.COUCHBASE_CONNECTION_SERVICE;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class CouchbaseMapCacheClientTest extends AbstractCouchbaseServiceTest {
+
+    private final Serializer<String> stringSerializer = (value, output) -> output.write(value.getBytes(StandardCharsets.UTF_8));
+    private final Deserializer<String> stringDeserializer = input -> new String(input, StandardCharsets.UTF_8);
+    private CouchbaseMapCacheClient mapCacheClient;
+
+    @BeforeEach
+    public void init() {
+        mapCacheClient = new CouchbaseMapCacheClient();
+    }
+
+    @Test
+    public void testCacheGet() throws CouchbaseException, IOException {
+        final CouchbaseClient client = mock(CouchbaseClient.class);
+        when(client.getDocument(anyString())).thenReturn(new CouchbaseGetResult(TEST_DOCUMENT_CONTENT.getBytes(), TEST_CAS));
+
+        final CouchbaseConnectionService connectionService = mockConnectionService(client);
+
+        final MockControllerServiceInitializationContext serviceInitializationContext = new MockControllerServiceInitializationContext(connectionService, CONNECTION_SERVICE_ID);
+        final Map<PropertyDescriptor, String> properties = Collections.singletonMap(COUCHBASE_CONNECTION_SERVICE, CONNECTION_SERVICE_ID);
+        final MockConfigurationContext context = new MockConfigurationContext(properties, serviceInitializationContext, new HashMap<>());
+
+        mapCacheClient.onEnabled(context);
+
+        final String result = mapCacheClient.get(TEST_DOCUMENT_ID, stringSerializer, stringDeserializer);
+
+        assertEquals(TEST_DOCUMENT_CONTENT, result);
+    }
+
+    @Test
+    public void testCacheGetFailure() throws CouchbaseException, IOException {

Review Comment:
   This is a valid case, not a real failure, so I would rename the test method to `testCacheGetNotFound()` or similar.
   The failure (exception) case can be tested separately.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseCasMismatchException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocExistsException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocNotFoundException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Optional;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();

Review Comment:
   The property is already defined in the parent class. So it can be deleted.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/test/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClientTest.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocNotFoundException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+import org.apache.nifi.services.couchbase.utils.CouchbaseUpsertResult;
+import org.apache.nifi.util.MockConfigurationContext;
+import org.apache.nifi.util.MockControllerServiceInitializationContext;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.nifi.services.couchbase.AbstractCouchbaseService.COUCHBASE_CONNECTION_SERVICE;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class CouchbaseMapCacheClientTest extends AbstractCouchbaseServiceTest {
+
+    private final Serializer<String> stringSerializer = (value, output) -> output.write(value.getBytes(StandardCharsets.UTF_8));
+    private final Deserializer<String> stringDeserializer = input -> new String(input, StandardCharsets.UTF_8);
+    private CouchbaseMapCacheClient mapCacheClient;
+
+    @BeforeEach
+    public void init() {
+        mapCacheClient = new CouchbaseMapCacheClient();
+    }
+
+    @Test
+    public void testCacheGet() throws CouchbaseException, IOException {
+        final CouchbaseClient client = mock(CouchbaseClient.class);
+        when(client.getDocument(anyString())).thenReturn(new CouchbaseGetResult(TEST_DOCUMENT_CONTENT.getBytes(), TEST_CAS));
+
+        final CouchbaseConnectionService connectionService = mockConnectionService(client);
+
+        final MockControllerServiceInitializationContext serviceInitializationContext = new MockControllerServiceInitializationContext(connectionService, CONNECTION_SERVICE_ID);
+        final Map<PropertyDescriptor, String> properties = Collections.singletonMap(COUCHBASE_CONNECTION_SERVICE, CONNECTION_SERVICE_ID);
+        final MockConfigurationContext context = new MockConfigurationContext(properties, serviceInitializationContext, new HashMap<>());
+
+        mapCacheClient.onEnabled(context);
+
+        final String result = mapCacheClient.get(TEST_DOCUMENT_ID, stringSerializer, stringDeserializer);
+
+        assertEquals(TEST_DOCUMENT_CONTENT, result);
+    }
+
+    @Test
+    public void testCacheGetFailure() throws CouchbaseException, IOException {
+        final CouchbaseClient client = mock(CouchbaseClient.class);
+        when(client.getDocument(anyString())).thenThrow(new CouchbaseDocNotFoundException("Test exception", null));
+
+        final CouchbaseConnectionService connectionService = mockConnectionService(client);
+
+        final MockControllerServiceInitializationContext serviceInitializationContext = new MockControllerServiceInitializationContext(connectionService, CONNECTION_SERVICE_ID);
+        final Map<PropertyDescriptor, String> properties = Collections.singletonMap(COUCHBASE_CONNECTION_SERVICE, CONNECTION_SERVICE_ID);
+        final MockConfigurationContext context = new MockConfigurationContext(properties, serviceInitializationContext, new HashMap<>());

Review Comment:
   This block could be extracted into a `BeforeEach` method in the abstract class in order to avoid copy-paste.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseCasMismatchException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocExistsException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseDocNotFoundException;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Optional;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseDocNotFoundException e) {
+            return null;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to fetch cache entry [%s] from Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+        final Optional<Long> revision = entry.getRevision();
+
+        if (revision.isEmpty()) {
+            try {
+                couchbaseClient.insertDocument(documentId, document);
+                return true;
+            } catch (CouchbaseDocExistsException e) {
+                return false;
+            } catch (CouchbaseException e) {
+                throw new IOException("Failed to insert cache entry [%s] into Couchbase".formatted(documentId), e);
+            }
+        }
+
+        try {
+            final long casValue = revision.get();
+            couchbaseClient.replaceDocument(documentId, document, casValue);
+            return true;
+        } catch (CouchbaseDocNotFoundException | CouchbaseCasMismatchException e) {
+            return false;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to replace cache entry [%s] in Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        final byte[] document = serializeDocument(value, valueSerializer);
+
+        try {
+            couchbaseClient.insertDocument(documentId, document);
+            return true;
+        } catch (CouchbaseDocExistsException e) {
+            return false;
+        } catch (CouchbaseException e) {
+            throw new IOException("Failed to insert cache entry [%s] into Couchbase".formatted(documentId), e);
+        }
+    }
+
+    @Override
+    public <K, V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final V document = get(key, keySerializer, valueDeserializer);
+        if (document != null) {
+            return document;
+        }
+
+        putIfAbsent(key, value, keySerializer, valueSerializer);

Review Comment:
   Due to concurrent updates, `get()` may return `null` but `putIfAbsent()` cannot insert the item because the key has been added between the two calls. I suggest checking the return value of `putIfAbsent()` and if it is `false`, try to retrieve the existing value from the cache again.



##########
nifi-extension-bundles/nifi-couchbase-bundle/nifi-couchbase-services/src/main/java/org/apache/nifi/services/couchbase/CouchbaseMapCacheClient.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.nifi.services.couchbase;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.distributed.cache.client.AtomicCacheEntry;
+import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient;
+import org.apache.nifi.distributed.cache.client.Deserializer;
+import org.apache.nifi.distributed.cache.client.Serializer;
+import org.apache.nifi.services.couchbase.exception.CouchbaseException;
+import org.apache.nifi.services.couchbase.utils.CouchbaseGetResult;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+@Tags({"distributed", "cache", "map", "cluster", "couchbase"})
+@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer." +
+        " This can be used in order to share a Map between nodes in a NiFi cluster." +
+        " Couchbase Server cluster can provide a high available and persistent cache storage.")
+public class CouchbaseMapCacheClient extends AbstractCouchbaseService implements AtomicDistributedMapCacheClient<Long> {
+
+    public static final PropertyDescriptor COUCHBASE_CONNECTION_SERVICE = new PropertyDescriptor.Builder()
+            .name("Couchbase Connection Service")
+            .description("A Couchbase Connection Service which manages connections to a Couchbase cluster.")
+            .required(true)
+            .identifiesControllerService(CouchbaseConnectionService.class)
+            .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            COUCHBASE_CONNECTION_SERVICE,
+            BUCKET_NAME,
+            SCOPE_NAME,
+            COLLECTION_NAME
+    );
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return PROPERTIES;
+    }
+
+    @Override
+    public <K, V> AtomicCacheEntry<K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException {
+        final String documentId = serializeDocumentKey(key, keySerializer);
+        try {
+            final CouchbaseGetResult result = couchbaseClient.getDocument(documentId);
+            return new AtomicCacheEntry<>(key, deserializeDocument(valueDeserializer, result.resultContent()), result.cas());
+        } catch (CouchbaseException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException {
+        final String documentId = serializeDocumentKey(entry.getKey(), keySerializer);
+        final byte[] document = serializeDocument(entry.getValue(), valueSerializer);
+
+        try {
+            couchbaseClient.replaceDocument(documentId, document);

Review Comment:
   The method has been extended with the insert step. Tested with Wait/Notify processors and it works correctly. 



-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3872803118

   > So, users would have to build it manually? Asking because I have to write a tutorial for our site about CB+Nifi and how to use it and, if its not in the assembly then I have this question on what would be the best way for people to install it? Would they have to download the sources, build the nar and install it as a plugin?
   > 
   > Ty.
   > 
   > > > Will the project pom.xml (not the bundle ones) be updated to include couchbase connector into nifi as part of this PR or as a separate change?
   > > 
   > > 
   > > The Couchbase NAR is rather large, given the extensive shaded content of the client library. For this reason, it is not included in the standard `nifi-assembly` binary.
   
   All project NAR files are published to Maven Central through the Apache Nexus Repository as part of the standard release process. This allows anyone to download the NAR, without having to build from source, but does require placing the NAR in an extensions directory that NiFi can read.


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "chedim (via GitHub)" <gi...@apache.org>.
chedim commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3861603233

   Will the project pom.xml (not the bundle ones) be updated to include couchbase connector into nifi as part of this PR or as a separate change?


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "deniswsrosa (via GitHub)" <gi...@apache.org>.
deniswsrosa commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3764064117

   If you all need any help, just let me know, I can also push some fixes.
   
   On Fri, Jan 16, 2026 at 3:50 PM David Handermann ***@***.***>
   wrote:
   
   > ***@***.**** commented on this pull request.
   >
   > @turcsanyip <https://github.com/turcsanyip> I will hold off on further
   > comments until you have completed your review. On a very cursory scan, I
   > notice a handful of mostly minor concerns related to exception handling,
   > such as lack of detailed messages and exceptions that are never logged in
   > some cases.
   >
   > Answering the main question about component usage would help guide where
   > to focus review cycles.
   >
   > Thanks for the work on this!
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/nifi/pull/10467#pullrequestreview-3671235622>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AABUXRQQTSJWABVQAJCBU3T4HD3D7AVCNFSM6AAAAACKKSEVCSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMNZRGIZTKNRSGI>
   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
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: issues-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-15145: Add RecordLookup, KeyValueLookup, and MapCacheClient Services for Couchbase bundle [nifi]

Posted by "deniswsrosa (via GitHub)" <gi...@apache.org>.
deniswsrosa commented on PR #10467:
URL: https://github.com/apache/nifi/pull/10467#issuecomment-3759943028

   @mark-bathori Do you need any help to resolve the conflicts? I can push a pr to your branch.


-- 
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: issues-unsubscribe@nifi.apache.org

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