Class ListenHTTP

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processors.standard.ListenHTTP
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@InputRequirement(INPUT_FORBIDDEN) @Tags({"ingest","http","https","rest","listen"}) @CapabilityDescription("Starts an HTTP Server and listens on a given base path to transform incoming requests into FlowFiles.\nThe default URI of the Service will be http://{hostname}:{port}/contentListener. Only HEAD and POST requests are\nsupported. GET, PUT, DELETE, OPTIONS and TRACE will result in an error and the HTTP response status code 405;\nCONNECT will also result in an error and the HTTP response status code 400.\nGET is supported on <service_URI>/healthcheck. If the service is available, it returns \"200 OK\" with the content \"OK\".\nThe health check functionality can be configured to be accessible via a different port.\nFor details, see the documentation of the \"Listening Port for health check requests\" property.\nA Record Reader and Record Writer property can be enabled on the processor to process incoming requests as records.\nRecord processing is not allowed for multipart requests and request in FlowFileV3 format (minifi).\nIf the incoming request contains a FlowFileV3 package format, the data will be unpacked automatically into individual\nFlowFile(s) contained within the package; the original FlowFile names are restored.\n") @UseCase(description="Unpack FlowFileV3 content received in a POST", keywords={"flowfile","flowfilev3","unpack"}, notes="POST requests with \"Content-Type: application/flowfile-v3\" will have their payload interpreted as FlowFileV3 format\nand will be automatically unpacked. This will output the original FlowFile(s) from within the FlowFileV3 format and\nwill not require a separate UnpackContent processor.\n", configuration="This feature of ListenHTTP is always on, no configuration required.\n\nThe MergeContent and PackageFlowFile processors can generate FlowFileV3 formatted data.\n") @MultiProcessorUseCase(description="Limit the date flow rate that is accepted",keywords={"rate","limit"},notes="When ListenHTTP cannot output FlowFiles due to back pressure, it will send HTTP 503 Service Unavailable\nresponse to clients, or deny connections, until more space is available in the output queue.\n",configurations={@ProcessorConfiguration(processorClass=ListenHTTP.class,configuration="Connect the \'success\' relationship of ListenHTTP to a ControlRate processor and configure back pressure on that\nconnection so that a small amount of data will fill the queue. The size of the back pressure configuration\ndetermines how much data to buffer to handle spikes in rate without affecting clients.\n"),@ProcessorConfiguration(processorClass=ControlRate.class,configuration="Use the ControlRate properties to set the desired data flow rate limit. When the limit it reached,\nthe ControlRate input connection will start accumulating files. When this connection is full, ListenHTTP\nwill limit the input data flow rate.\n")}) public class ListenHTTP extends org.apache.nifi.processor.AbstractSessionFactoryProcessor
  • Field Details

    • MATCH_ALL

      private static final String MATCH_ALL
      See Also:
    • initialized

      private final AtomicBoolean initialized
    • runOnPrimary

      private final AtomicBoolean runOnPrimary
    • BASE_PATH

      public static final org.apache.nifi.components.PropertyDescriptor BASE_PATH
    • PORT

      public static final org.apache.nifi.components.PropertyDescriptor PORT
    • HEALTH_CHECK_PORT

      public static final org.apache.nifi.components.PropertyDescriptor HEALTH_CHECK_PORT
    • AUTHORIZED_DN_PATTERN

      public static final org.apache.nifi.components.PropertyDescriptor AUTHORIZED_DN_PATTERN
    • AUTHORIZED_ISSUER_DN_PATTERN

      public static final org.apache.nifi.components.PropertyDescriptor AUTHORIZED_ISSUER_DN_PATTERN
    • MAX_UNCONFIRMED_TIME

      public static final org.apache.nifi.components.PropertyDescriptor MAX_UNCONFIRMED_TIME
    • SSL_CONTEXT_SERVICE

      public static final org.apache.nifi.components.PropertyDescriptor SSL_CONTEXT_SERVICE
    • HTTP_PROTOCOL_STRATEGY

      public static final org.apache.nifi.components.PropertyDescriptor HTTP_PROTOCOL_STRATEGY
    • HEADERS_AS_ATTRIBUTES_REGEX

      public static final org.apache.nifi.components.PropertyDescriptor HEADERS_AS_ATTRIBUTES_REGEX
    • REQUEST_HEADER_MAX_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor REQUEST_HEADER_MAX_SIZE
    • RETURN_CODE

      public static final org.apache.nifi.components.PropertyDescriptor RETURN_CODE
    • MULTIPART_REQUEST_MAX_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MULTIPART_REQUEST_MAX_SIZE
    • MULTIPART_READ_BUFFER_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MULTIPART_READ_BUFFER_SIZE
    • CLIENT_AUTHENTICATION

      public static final org.apache.nifi.components.PropertyDescriptor CLIENT_AUTHENTICATION
    • MAX_THREAD_POOL_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MAX_THREAD_POOL_SIZE
    • RECORD_READER

      public static final org.apache.nifi.components.PropertyDescriptor RECORD_READER
    • RECORD_WRITER

      public static final org.apache.nifi.components.PropertyDescriptor RECORD_WRITER
    • PROPERTY_DESCRIPTORS

      protected static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • RELATIONSHIP_SUCCESS

      public static final org.apache.nifi.processor.Relationship RELATIONSHIP_SUCCESS
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • CONTEXT_ATTRIBUTE_PROCESSOR

      public static final String CONTEXT_ATTRIBUTE_PROCESSOR
      See Also:
    • CONTEXT_ATTRIBUTE_LOGGER

      public static final String CONTEXT_ATTRIBUTE_LOGGER
      See Also:
    • CONTEXT_ATTRIBUTE_SESSION_FACTORY_HOLDER

      public static final String CONTEXT_ATTRIBUTE_SESSION_FACTORY_HOLDER
      See Also:
    • CONTEXT_ATTRIBUTE_PROCESS_CONTEXT_HOLDER

      public static final String CONTEXT_ATTRIBUTE_PROCESS_CONTEXT_HOLDER
      See Also:
    • CONTEXT_ATTRIBUTE_AUTHORITY_PATTERN

      public static final String CONTEXT_ATTRIBUTE_AUTHORITY_PATTERN
      See Also:
    • CONTEXT_ATTRIBUTE_AUTHORITY_ISSUER_PATTERN

      public static final String CONTEXT_ATTRIBUTE_AUTHORITY_ISSUER_PATTERN
      See Also:
    • CONTEXT_ATTRIBUTE_HEADER_PATTERN

      public static final String CONTEXT_ATTRIBUTE_HEADER_PATTERN
      See Also:
    • CONTEXT_ATTRIBUTE_FLOWFILE_MAP

      public static final String CONTEXT_ATTRIBUTE_FLOWFILE_MAP
      See Also:
    • CONTEXT_ATTRIBUTE_BASE_PATH

      public static final String CONTEXT_ATTRIBUTE_BASE_PATH
      See Also:
    • CONTEXT_ATTRIBUTE_RETURN_CODE

      public static final String CONTEXT_ATTRIBUTE_RETURN_CODE
      See Also:
    • CONTEXT_ATTRIBUTE_MULTIPART_REQUEST_MAX_SIZE

      public static final String CONTEXT_ATTRIBUTE_MULTIPART_REQUEST_MAX_SIZE
      See Also:
    • CONTEXT_ATTRIBUTE_MULTIPART_READ_BUFFER_SIZE

      public static final String CONTEXT_ATTRIBUTE_MULTIPART_READ_BUFFER_SIZE
      See Also:
    • CONTEXT_ATTRIBUTE_PORT

      public static final String CONTEXT_ATTRIBUTE_PORT
      See Also:
    • server

      private volatile org.eclipse.jetty.server.Server server
    • flowFileMap

    • sessionFactoryReference

      private final AtomicReference<org.apache.nifi.processor.ProcessSessionFactory> sessionFactoryReference
  • Constructor Details

    • ListenHTTP

      public ListenHTTP()
  • Method Details

    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.apache.nifi.components.AbstractConfigurableComponent
    • validatePortsAreNotEqual

      private void validatePortsAreNotEqual(org.apache.nifi.components.ValidationContext context, Collection<org.apache.nifi.components.ValidationResult> validationResults)
    • createValidationResult

      private org.apache.nifi.components.ValidationResult createValidationResult(String subject, String explanation)
    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • migrateProperties

      public void migrateProperties(PropertyConfiguration config)
    • shutdownHttpServer

      @OnShutdown @OnStopped public void shutdownHttpServer()
    • getServer

      org.eclipse.jetty.server.Server getServer()
    • shutdownHttpServer

      private void shutdownHttpServer(org.eclipse.jetty.server.Server toShutdown)
    • createHttpServerFromService

      private void createHttpServerFromService(org.apache.nifi.processor.ProcessContext context) throws Exception
      Throws:
      Exception
    • getClientAuthentication

      private ListenHTTP.ClientAuthentication getClientAuthentication(SSLContextProvider sslContextProvider, org.apache.nifi.processor.ProcessContext context)
    • isTrustManagerConfigured

      private boolean isTrustManagerConfigured(X509TrustManager configuredTrustManager)
    • createServerConnector

      private org.eclipse.jetty.server.ServerConnector createServerConnector(org.eclipse.jetty.server.Server server, int port, int requestMaxHeaderSize, SSLContextProvider sslContextProvider, ListenHTTP.ClientAuthentication clientAuthentication, HttpProtocolStrategy httpProtocolStrategy)
    • clearInit

      @OnScheduled public void clearInit()
    • getServerClasses

      protected Set<Class<? extends jakarta.servlet.Servlet>> getServerClasses()
    • findOldFlowFileIds

      private Set<String> findOldFlowFileIds(org.apache.nifi.processor.ProcessContext ctx)
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory) throws org.apache.nifi.processor.exception.ProcessException
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • onPrimaryNodeChange

      @OnPrimaryNodeStateChange public void onPrimaryNodeChange(org.apache.nifi.annotation.notification.PrimaryNodeState newState)