NIFI-10028: Added QuerySalesforceObject additionalDetails and improved age field property descriptions

This closes #6047

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Lehel 2022-05-16 16:30:57 +02:00 committed by exceptionfactory
parent bd1e033d55
commit eba1318529
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
2 changed files with 78 additions and 9 deletions

View File

@ -171,8 +171,8 @@ public class QuerySalesforceObject extends AbstractProcessor {
static final PropertyDescriptor AGE_FIELD = new PropertyDescriptor.Builder()
.name("age-field")
.displayName("Age Field")
.description("The name of a TIMESTAMP field that will be used to limit all and filter already retrieved records."
+ " Only records that are older than the previous run time of this processor will be retrieved."
.description("The name of a TIMESTAMP field that will be used to filter records using a bounded time window."
+ "The processor will return only those records with a timestamp value newer than the timestamp recorded after the last processor run."
)
.required(false)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
@ -182,9 +182,8 @@ public class QuerySalesforceObject extends AbstractProcessor {
static final PropertyDescriptor AGE_DELAY = new PropertyDescriptor.Builder()
.name("age-delay")
.displayName("Age Delay")
.description("When 'Age Field' is set the age-based filter will be adjusted by this amount."
+ " Only records that are older than the previous run time of this processor, by at least this amount, will be retrieved."
)
.description("The ending timestamp of the time window will be adjusted earlier by the amount configured in this property." +
" For example, with a property value of 10 seconds, an ending timestamp of 12:30:45 would be changed to 12:30:35.")
.required(false)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
@ -193,10 +192,8 @@ public class QuerySalesforceObject extends AbstractProcessor {
static final PropertyDescriptor INITIAL_AGE_FILTER = new PropertyDescriptor.Builder()
.name("initial-age-filter")
.displayName("Initial Age Filter")
.description("When 'Age Field' is set the value of this property will serve as a filter when this processor runs the first time."
+ " Only records that are older than this value be retrieved."
)
.displayName("Initial Age Start Time")
.description("This property specifies the start time that the processor applies when running the first query.")
.required(false)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<!--
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.
-->
<head>
<meta charset="utf-8"/>
<title>QuerySalesforceObject</title>
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/>
<style>
h2 {margin-top: 4em}
h3 {margin-top: 3em}
td {text-align: left}
</style>
</head>
<body>
<h1>QuerySalesforceObject</h1>
<h3>Description</h3>
<p>
Objects in Salesforce are database tables, their rows are known as records, and their columns are called fields. The QuerySalesforceObject processor queries Salesforce objects and retrieves their records.
The processor constructs the query using SOQL (Salesforce Object Query Language) and retrieves the result record dataset using the Salesforce REST API.
The processor utilizes streams and NiFi record-based processing to be able to handle a large number of records and to allow arbitrary output format.
</p>
<h3>OAuth2 Access Token Provider Service</h3>
<p>
The OAuth2 Access Token Provider Service handles Salesforce REST API authorization. In order to use OAuth2 authorization, create a new StandardOauth2AccessTokenProvider service and configure it as follows.
</p>
<ul>
<li>Authorization Server URL: It is the concatenation of the Salesforce URL and the token request service URL (/services/oauth2/token).</li>
<li>Grant Type: User Password.</li>
<li>Username: The email address registered in the Salesforce account.</li>
<li>Password: For the Password a Security token must be requested. Go to Profile -> Settings and under the Reset My Security Token option, request one, which will be sent to the registered email address.
The password is made up of the Salesforce account password and the Security token concatenated together without a space.</li>
<li>Client ID: Create a new Connected App within Salesforce. Go to Setup -> On the left search panel find App Manager -> Create New Connected App. Once its done, the Consumer Key goes to the Client ID property.</li>
<li>Client Secret: Available on the Connected App page under Consumer Secret.</li>
</ul>
<h3>Age properties</h3>
<p>
The age properties are important to avoid processing duplicate records. Age filtering provides a sliding window that starts with the processors prior run time and ends with the current run time minus the age delay.
Only records that are within the sliding window are queried and processed. On the processor, the Age Field property must be a datetime field of the queried object, this will be subject to the condition that it is greater
than the processor's previous but less than the current run time (e.g. LastModifiedDate). The first run, for example, will query records whose LastModifiedDate field is earlier than the current run time. The second will
look for records with LastModifiedDate fields that are later than the previous run time but earlier than the current run time.
</p>
<p>
The processor uses the Initial Age Filter as a specific timestamp that sets the beginning of the sliding window from which processing builds the initial query. The format must adhere to
the Salesforce SOQL standards (see Salesforce documentation). The Age Delay moves the time of the records to be processed earlier than the current run time if necessary.
</p>
</body>
</html>