Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/721#discussion_r79940293
  
    --- Diff: 
nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/main/java/org/apache/nifi/processors/ignite/cache/GetIgniteCache.java
 ---
    @@ -0,0 +1,119 @@
    +/*
    + * 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.processors.ignite.cache;
    +
    +import java.io.ByteArrayInputStream;
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.commons.lang3.StringUtils;
    +import org.apache.nifi.annotation.behavior.EventDriven;
    +import org.apache.nifi.annotation.behavior.InputRequirement;
    +import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
    +import org.apache.nifi.annotation.behavior.SupportsBatching;
    +import org.apache.nifi.annotation.behavior.WritesAttribute;
    +import org.apache.nifi.annotation.behavior.WritesAttributes;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.SeeAlso;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.annotation.lifecycle.OnScheduled;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.exception.ProcessException;
    +
    +/**
    + * Get cache processors which gets byte array for the key from Ignite 
cache and set the array
    + * as the FlowFile content.
    + */
    +@EventDriven
    +@SupportsBatching
    +@Tags({ "Ignite", "get", "read", "cache", "key" })
    +@InputRequirement(Requirement.INPUT_REQUIRED)
    +@CapabilityDescription("Get the byte array from Ignite Cache and adds it 
as the content of a FlowFile." +
    +    "The processor uses the value of FlowFile attribute (Ignite cache 
entry key) as the cache key lookup. " +
    +    "If the entry corresponding to the key is not found in the cache an 
error message is associated with the FlowFile " +
    +    "Note - The Ignite Kernel periodically outputs node performance 
statistics to the logs. This message " +
    +    " can be turned off by setting the log level for logger 
'org.apache.ignite' to WARN in the logback.xml configuration file.")
    +@WritesAttributes({
    +    @WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY, description = "The 
reason for getting entry from cache"),
    +    @WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_MISSING_KEY_MESSAGE, description = "The 
FlowFile key attribute was missing.")
    +    })
    +@SeeAlso({PutIgniteCache.class})
    +public class GetIgniteCache extends AbstractIgniteCacheProcessor {
    +
    +    /** Flow file attribute keys and messages */
    +    public static final String IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY = 
"ignite.cache.get.failed.reason";
    +    public static final String IGNITE_GET_FAILED_MISSING_KEY_MESSAGE = 
"The FlowFile key attribute was missing";
    +    public static final String IGNITE_GET_FAILED_MISSING_ENTRY_MESSAGE = 
"The cache byte array entry was null or zero length";
    +    public static final String IGNITE_GET_FAILED_MESSAGE_PREFIX = "The 
cache request failed because of ";
    +
    +    static {
    +        descriptors = new ArrayList<>();
    --- End diff --
    
    You are sharing a static reference for descriptors in both processors, it 
results in a race condition and not all properties are present. Have a look to 
other processors extending an abstract class to have an example.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to