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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate final ConcurrentMap<String, ListenHTTP.FlowFileEntryTimeWrapper> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicBooleanprivate static final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprotected static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicBooleanprivate org.eclipse.jetty.server.Serverprivate final AtomicReference<org.apache.nifi.processor.ProcessSessionFactory> static final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate voidcreateHttpServerFromService(org.apache.nifi.processor.ProcessContext context) private org.eclipse.jetty.server.ServerConnectorcreateServerConnector(org.eclipse.jetty.server.Server server, int port, int requestMaxHeaderSize, SSLContextProvider sslContextProvider, ListenHTTP.ClientAuthentication clientAuthentication, HttpProtocolStrategy httpProtocolStrategy) private org.apache.nifi.components.ValidationResultcreateValidationResult(String subject, String explanation) protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) findOldFlowFileIds(org.apache.nifi.processor.ProcessContext ctx) private ListenHTTP.ClientAuthenticationgetClientAuthentication(SSLContextProvider sslContextProvider, org.apache.nifi.processor.ProcessContext context) Set<org.apache.nifi.processor.Relationship> (package private) org.eclipse.jetty.server.Serverprotected List<org.apache.nifi.components.PropertyDescriptor> private booleanisTrustManagerConfigured(X509TrustManager configuredTrustManager) voidvoidonPrimaryNodeChange(org.apache.nifi.annotation.notification.PrimaryNodeState newState) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory) voidprivate voidshutdownHttpServer(org.eclipse.jetty.server.Server toShutdown) private voidvalidatePortsAreNotEqual(org.apache.nifi.components.ValidationContext context, Collection<org.apache.nifi.components.ValidationResult> validationResults) Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateRelationships
-
Field Details
-
MATCH_ALL
- See Also:
-
initialized
-
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
-
RELATIONSHIP_SUCCESS
public static final org.apache.nifi.processor.Relationship RELATIONSHIP_SUCCESS -
RELATIONSHIPS
-
CONTEXT_ATTRIBUTE_PROCESSOR
- See Also:
-
CONTEXT_ATTRIBUTE_LOGGER
- See Also:
-
CONTEXT_ATTRIBUTE_SESSION_FACTORY_HOLDER
- See Also:
-
CONTEXT_ATTRIBUTE_PROCESS_CONTEXT_HOLDER
- See Also:
-
CONTEXT_ATTRIBUTE_AUTHORITY_PATTERN
- See Also:
-
CONTEXT_ATTRIBUTE_AUTHORITY_ISSUER_PATTERN
- See Also:
-
CONTEXT_ATTRIBUTE_HEADER_PATTERN
- See Also:
-
CONTEXT_ATTRIBUTE_FLOWFILE_MAP
- See Also:
-
CONTEXT_ATTRIBUTE_BASE_PATH
- See Also:
-
CONTEXT_ATTRIBUTE_RETURN_CODE
- See Also:
-
CONTEXT_ATTRIBUTE_MULTIPART_REQUEST_MAX_SIZE
- See Also:
-
CONTEXT_ATTRIBUTE_MULTIPART_READ_BUFFER_SIZE
- See Also:
-
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:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
validatePortsAreNotEqual
private void validatePortsAreNotEqual(org.apache.nifi.components.ValidationContext context, Collection<org.apache.nifi.components.ValidationResult> validationResults) -
createValidationResult
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
migrateProperties
-
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
-
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
-
findOldFlowFileIds
-
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)
-