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

    https://github.com/apache/nifi/pull/2702#discussion_r197460635
  
    --- Diff: 
nifi-nar-bundles/nifi-pulsar-bundle/nifi-pulsar-processors/src/main/java/org/apache/nifi/processors/pulsar/AbstractPulsarProcessor.java
 ---
    @@ -0,0 +1,55 @@
    +/*
    + * 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.pulsar;
    +
    +
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.processor.AbstractProcessor;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.pulsar.PulsarClientService;
    +import org.apache.pulsar.client.api.PulsarClient;
    +
    +public abstract class AbstractPulsarProcessor extends AbstractProcessor {
    +
    +    public static final PropertyDescriptor PULSAR_CLIENT_SERVICE = new 
PropertyDescriptor.Builder()
    +            .name("Pulsar Client Service")
    +            .description("Specified the Pulsar Client Service that can be 
used to create Pulsar connections")
    +            .required(true)
    +            .identifiesControllerService(PulsarClientService.class)
    +            .build();
    +
    +    public static final Relationship REL_SUCCESS = new 
Relationship.Builder()
    +            .name("success")
    +            .description("FlowFiles for which all content was sent to 
Pulsar.")
    +            .build();
    +
    +    public static final Relationship REL_FAILURE = new 
Relationship.Builder()
    +            .name("failure")
    +            .description("Any FlowFile that cannot be sent to Pulsar will 
be routed to this Relationship")
    +            .build();
    +
    +    protected PulsarClient client;
    +
    +    protected PulsarClient getPulsarClient(ProcessContext context) {
    +        if (client == null) {
    --- End diff --
    
    This is not thread-safe. All processors must be thread-safe.


---

Reply via email to