Insert
The Insert
action inserts items into a repository.
Type: asynchronous
Parameter | Description | Required |
---|---|---|
ConnectorGroup
|
The name of the connector group to send the request to. This must match the name you specified when you configured the ConnectorGroupRouter processor in your dataflow. |
Yes |
Documents
|
XML that describes how to insert the item(s). Each item to insert is represented by a <documents> <document file_part_name="file_part" migration_uri="/folder/file.txt"> <IDENTIFIER> <reference>/opt/files/file.txt</reference> <type>File</type> <property name="..." value="..." /> <property name="..." value="..." /> </IDENTIFIER> </document> </documents> The The The
|
Yes |
Custom parameters |
Any other parameters that you set are added to the FlowFile, created by the HandleAciRequest processor, that represents the action. When a connector processes the action, it adds the parameters to any FlowFiles that it generates. The parameters are added as FlowFile attributes named FlowFile attributes can be referenced by processor properties that support expression language, and can be read by Lua scripts. You can therefore set custom parameters to customize processing within NiFi. The maximum size for a custom parameter value is 4KB. |
No |
Example
The following example uses the command-line tool cURL to send an insert action.
This example uses a File System Connector Group to insert a file into the file system. The file to insert is file.txt
in the current working directory.
curl http://host:10000/action=Insert -F ConnectorGroup=FileSystem -F "Documents=<documents.xml" -F "file_part=@file.txt"
In this example, the XML that describes where to insert the item is read from the file documents.xml
in the current working directory. This file might contain the following XML:
<documents> <document file_part_name="file_part"> <IDENTIFIER> <reference>/opt/files/file.txt</reference> <type>File</type> </IDENTIFIER> </document> </documents>
Notice that the value of the file_part_name
attribute matches the name of the part, in the request, that contains the file to insert. The connector inserts the file into the file system at the location /opt/files/file.txt
.
Response
This is an asynchronous action, so you receive a token in response to the request. You can use the QueueInfo action to see the result of the action, including the identifiers of successfully inserted documents.