From 529c066c7247b5467ce1274c28539dcabb8acfb7 Mon Sep 17 00:00:00 2001 From: Wil Selwood Date: Thu, 6 Dec 2018 10:17:19 +0000 Subject: [PATCH 1/5] Improve docs around the PriorityAttributePrioritizer Clear up the documentation around the PriorityAttributePrioritizer to make it clearer that if the attributes are both number the largest wins but if they are not numbers they sort the other way around. I had to go and look at the code to work out what was going on after reading the existing documentation. --- nifi-docs/src/main/asciidoc/user-guide.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nifi-docs/src/main/asciidoc/user-guide.adoc b/nifi-docs/src/main/asciidoc/user-guide.adoc index 873b9496b9c4..ec109effc931 100644 --- a/nifi-docs/src/main/asciidoc/user-guide.adoc +++ b/nifi-docs/src/main/asciidoc/user-guide.adoc @@ -1091,7 +1091,7 @@ The following prioritizers are available: - *FirstInFirstOutPrioritizer*: Given two FlowFiles, the one that reached the connection first will be processed first. - *NewestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is newest in the dataflow will be processed first. - *OldestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is oldest in the dataflow will be processed first. 'This is the default scheme that is used if no prioritizers are selected'. -- *PriorityAttributePrioritizer*: Given two FlowFiles that both have a "priority" attribute, the one that has the highest priority value will be processed first. Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set. Values for the "priority" attribute may be alphanumeric, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example. +- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. If the attributes can be parsed as a long, they will be ordered largest number first. For example 9 will come before 1 and 100 will be selected before 99. If only one of them parses as a long that one will be considered to have the higher priority. Otherwise, they will be ordered in alphanumeric order, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example. NOTE: With a <> configured, the connection has a queue per node in addition to the local queue. The prioritizer will sort the data in each queue independently. From 3e3240e4c04388bd39cec2599cdac9d6e31dc8ab Mon Sep 17 00:00:00 2001 From: Wil Selwood Date: Fri, 7 Dec 2018 09:29:18 +0000 Subject: [PATCH 2/5] Simplify PriorityAttributePrioritzer docs Simplify the main section of documentation for PriorityAttributePrioritzer and then add a notes section with more details about the ordering. --- nifi-docs/src/main/asciidoc/user-guide.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nifi-docs/src/main/asciidoc/user-guide.adoc b/nifi-docs/src/main/asciidoc/user-guide.adoc index ec109effc931..5dd56bc249d0 100644 --- a/nifi-docs/src/main/asciidoc/user-guide.adoc +++ b/nifi-docs/src/main/asciidoc/user-guide.adoc @@ -1091,10 +1091,12 @@ The following prioritizers are available: - *FirstInFirstOutPrioritizer*: Given two FlowFiles, the one that reached the connection first will be processed first. - *NewestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is newest in the dataflow will be processed first. - *OldestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is oldest in the dataflow will be processed first. 'This is the default scheme that is used if no prioritizers are selected'. -- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. If the attributes can be parsed as a long, they will be ordered largest number first. For example 9 will come before 1 and 100 will be selected before 99. If only one of them parses as a long that one will be considered to have the higher priority. Otherwise, they will be ordered in alphanumeric order, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example. +- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. Then they will be ordered smallest first. For example "1" will come before "9", "99" will be selected before "100" and "a" before "b". NOTE: With a <> configured, the connection has a queue per node in addition to the local queue. The prioritizer will sort the data in each queue independently. +NOTE: With the PriorityAttributePrioritizer it will attempt to parse the "priority" attribute as a long. If this doesn't work it will use unicode string ordering. For example: "99" and "100" will be ordered so the flowfile with "1" comes first, but "A-99" and "A-100" will sort so the flowfile with "A-100" comes first. + ==== Changing Configuration and Context Menu Options After a connection has been drawn between two components, the connection's configuration may be changed, and the connection may be moved to a new destination; however, the processors on either side of the connection must be stopped before a configuration or destination change may be made. From 1c50332193bb9f9318d3b27382be35fad87b9805 Mon Sep 17 00:00:00 2001 From: Wil Selwood Date: Fri, 7 Dec 2018 09:30:47 +0000 Subject: [PATCH 3/5] Fix example. --- nifi-docs/src/main/asciidoc/user-guide.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nifi-docs/src/main/asciidoc/user-guide.adoc b/nifi-docs/src/main/asciidoc/user-guide.adoc index 5dd56bc249d0..81599bba4335 100644 --- a/nifi-docs/src/main/asciidoc/user-guide.adoc +++ b/nifi-docs/src/main/asciidoc/user-guide.adoc @@ -1095,7 +1095,7 @@ The following prioritizers are available: NOTE: With a <> configured, the connection has a queue per node in addition to the local queue. The prioritizer will sort the data in each queue independently. -NOTE: With the PriorityAttributePrioritizer it will attempt to parse the "priority" attribute as a long. If this doesn't work it will use unicode string ordering. For example: "99" and "100" will be ordered so the flowfile with "1" comes first, but "A-99" and "A-100" will sort so the flowfile with "A-100" comes first. +NOTE: With the PriorityAttributePrioritizer it will attempt to parse the "priority" attribute as a long. If this doesn't work it will use unicode string ordering. For example: "99" and "100" will be ordered so the flowfile with "99" comes first, but "A-99" and "A-100" will sort so the flowfile with "A-100" comes first. ==== Changing Configuration and Context Menu Options After a connection has been drawn between two components, the connection's configuration may be changed, and the connection may be moved to a new destination; however, the processors on either side of the connection must be stopped before a configuration or destination change may be made. From f54ad06b69350894cc353c0f0aa98df18652f553 Mon Sep 17 00:00:00 2001 From: Wil Selwood Date: Fri, 7 Dec 2018 09:38:12 +0000 Subject: [PATCH 4/5] Put back comment setting the priority attribute --- nifi-docs/src/main/asciidoc/user-guide.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nifi-docs/src/main/asciidoc/user-guide.adoc b/nifi-docs/src/main/asciidoc/user-guide.adoc index 81599bba4335..3163356fb704 100644 --- a/nifi-docs/src/main/asciidoc/user-guide.adoc +++ b/nifi-docs/src/main/asciidoc/user-guide.adoc @@ -1091,7 +1091,7 @@ The following prioritizers are available: - *FirstInFirstOutPrioritizer*: Given two FlowFiles, the one that reached the connection first will be processed first. - *NewestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is newest in the dataflow will be processed first. - *OldestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is oldest in the dataflow will be processed first. 'This is the default scheme that is used if no prioritizers are selected'. -- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. Then they will be ordered smallest first. For example "1" will come before "9", "99" will be selected before "100" and "a" before "b". +- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. Then they will be ordered smallest first. For example "1" will come before "9", "99" will be selected before "100" and "a" before "b". Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set. NOTE: With a <> configured, the connection has a queue per node in addition to the local queue. The prioritizer will sort the data in each queue independently. From b7da864fdfb4cb02d581737215d412edd2d27a6b Mon Sep 17 00:00:00 2001 From: Wil Selwood Date: Mon, 10 Dec 2018 14:07:19 +0000 Subject: [PATCH 5/5] Further improvements to the Priority ordering --- nifi-docs/src/main/asciidoc/user-guide.adoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nifi-docs/src/main/asciidoc/user-guide.adoc b/nifi-docs/src/main/asciidoc/user-guide.adoc index 3163356fb704..325b49c4ee63 100644 --- a/nifi-docs/src/main/asciidoc/user-guide.adoc +++ b/nifi-docs/src/main/asciidoc/user-guide.adoc @@ -1091,12 +1091,14 @@ The following prioritizers are available: - *FirstInFirstOutPrioritizer*: Given two FlowFiles, the one that reached the connection first will be processed first. - *NewestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is newest in the dataflow will be processed first. - *OldestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is oldest in the dataflow will be processed first. 'This is the default scheme that is used if no prioritizers are selected'. -- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. Then they will be ordered smallest first. For example "1" will come before "9", "99" will be selected before "100" and "a" before "b". Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set. +- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. The one that has the lowest priority value will be processed first. +** Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set. +** If only one has that attribute it will go first. +** Values for the "priority" attribute can be alphanumeric, where "a" will come before "z" and "1" before "9" +** If "priority" attribute cannot be parsed as a long, unicode string ordering will be used. For example: "99" and "100" will be ordered so the flowfile with "99" comes first, but "A-99" and "A-100" will sort so the flowfile with "A-100" comes first. NOTE: With a <> configured, the connection has a queue per node in addition to the local queue. The prioritizer will sort the data in each queue independently. -NOTE: With the PriorityAttributePrioritizer it will attempt to parse the "priority" attribute as a long. If this doesn't work it will use unicode string ordering. For example: "99" and "100" will be ordered so the flowfile with "99" comes first, but "A-99" and "A-100" will sort so the flowfile with "A-100" comes first. - ==== Changing Configuration and Context Menu Options After a connection has been drawn between two components, the connection's configuration may be changed, and the connection may be moved to a new destination; however, the processors on either side of the connection must be stopped before a configuration or destination change may be made.