Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/references/ubuntu_22_04_clang_arm_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12206,7 +12206,7 @@
"name": "Keep Source File",
"description": "If true, the file is not deleted after it has been copied to the Content Repository",
"validator": "BOOLEAN_VALIDATOR",
"required": "false",
"required": "true",
"sensitive": "false",
"expressionLanguageScope": "NONE",
"defaultValue": "false"
Expand Down Expand Up @@ -12255,7 +12255,7 @@
"name": "Recurse Subdirectories",
"description": "Indicates whether or not to pull files from subdirectories",
"validator": "BOOLEAN_VALIDATOR",
"required": "false",
"required": "true",
"sensitive": "false",
"expressionLanguageScope": "NONE",
"defaultValue": "true"
Expand Down Expand Up @@ -12357,23 +12357,23 @@
"Attributes to Ignore": {
"name": "Attributes to Ignore",
"description": "A comma-separated list of Attributes to ignore. If not specified, no attributes will be ignored.",
"validator": "VALID",
"validator": "NON_BLANK_VALIDATOR",
"required": "false",
"sensitive": "false",
"expressionLanguageScope": "NONE"
},
"Attributes to Log": {
"name": "Attributes to Log",
"description": "A comma-separated list of Attributes to Log. If not specified, all attributes will be logged.",
"validator": "VALID",
"validator": "NON_BLANK_VALIDATOR",
"required": "false",
"sensitive": "false",
"expressionLanguageScope": "NONE"
},
"FlowFiles To Log": {
"name": "FlowFiles To Log",
"description": "Number of flow files to log. If set to zero all flow files will be logged. Please note that this may block other threads from running if not used judiciously.",
"validator": "VALID",
"validator": "NON_NEGATIVE_INTEGER_VALIDATOR",
"required": "true",
"sensitive": "false",
"expressionLanguageScope": "NONE",
Expand Down Expand Up @@ -12460,6 +12460,19 @@
},
{
"propertyDescriptors": {
"Dummy Controller Service": {
"typeProvidedByValue": {
"type": "minifi_rs_playground.controller_services.dummy_controller_service.DummyControllerService",
"group": "org.apache.nifi.minifi.rust.test",
"artifact": "minifi_rs_playground"
},
"name": "Dummy Controller Service",
"description": "Optional dummy controller service",
"validator": "VALID",
"required": "false",
"sensitive": "false",
"expressionLanguageScope": "NONE"
},
"Lorem Ipsum Controller Service": {
"typeProvidedByValue": {
"type": "minifi_rs_playground.controller_services.lorem_ipsum_controller_service.LoremIpsumControllerService",
Expand Down
1 change: 1 addition & 0 deletions minifi_rust/extensions/minifi_rs_playground/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ hex = "0.4.3"
strum_macros = "0.28.0"
lipsum = "0.9.1"


[dev-dependencies]
tempfile = "3.22.0"
filetime = "0.2.26"
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Feature: Testing controller service api casting
And the "Extra information" property of the Wolfie the magical controller service is set to "The dog (Canis familiaris or Canis lupus familiaris) is a domesticated descendant of wolves."
When the MiNiFi instance starts up

Then the Minifi logs contain the following message: "[minifi_rs_playground::processors::zoo_processor::ZooProcessorRs] [critical] Can DogControllerRs { has_jetpack: true, extra_info: "The dog (Canis familiaris or Canis lupus familiaris) is a domesticated descendant of wolves." } fly? true" in less than 10 seconds
Then the Minifi logs contain the following message: "[minifi_rs_playground::processors::zoo_processor::ZooProcessorRs] [critical] Can DogControllerRs { has_jetpack: true, extra_info: Some("The dog (Canis familiaris or Canis lupus familiaris) is a domesticated descendant of wolves.") } fly? true" in less than 10 seconds
And the Minifi logs do not contain errors
And the Minifi logs do not contain warnings
30 changes: 15 additions & 15 deletions minifi_rust/extensions/minifi_rs_playground/minifi_rs_playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,24 @@ RUST TEST PROCESSOR: Creates FlowFiles from files in a directory. MiNiFi will ig

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

| Name | Default Value | Allowable Values | Description |
|-------------------------|---------------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Batch Size** | 10 | | The maximum number of files to pull in each iteration |
| **Ignore Hidden Files** | true | true<br/>false | Indicates whether or not hidden files should be ignored |
| **Input Directory** | | | The input directory from which to pull files<br/>**Supports Expression Language: true** |
| Keep Source File | false | true<br/>false | If true, the file is not deleted after it has been copied to the Content Repository |
| Maximum File Age | | | The maximum age that a file must be in order to be pulled; any file older than this amount of time (according to last modification date) will be ignored |
| Maximum File Size | | | The maximum size that a file can be in order to be pulled |
| Minimum File Age | | | The minimum age that a file must be in order to be pulled; any file younger than this amount of time (according to last modification date) will be ignored |
| Minimum File Size | | | The minimum size that a file can be in order to be pulled |
| Polling Interval | | | Indicates how long to wait before performing a directory listing |
| Recurse Subdirectories | true | true<br/>false | Indicates whether or not to pull files from subdirectories |
| Name | Default Value | Allowable Values | Description |
|----------------------------|---------------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Batch Size** | 10 | | The maximum number of files to pull in each iteration |
| **Ignore Hidden Files** | true | true<br/>false | Indicates whether or not hidden files should be ignored |
| **Input Directory** | | | The input directory from which to pull files<br/>**Supports Expression Language: true** |
| **Keep Source File** | false | true<br/>false | If true, the file is not deleted after it has been copied to the Content Repository |
| Maximum File Age | | | The maximum age that a file must be in order to be pulled; any file older than this amount of time (according to last modification date) will be ignored |
| Maximum File Size | | | The maximum size that a file can be in order to be pulled |
| Minimum File Age | | | The minimum age that a file must be in order to be pulled; any file younger than this amount of time (according to last modification date) will be ignored |
| Minimum File Size | | | The minimum size that a file can be in order to be pulled |
| Polling Interval | | | Indicates how long to wait before performing a directory listing |
| **Recurse Subdirectories** | true | true<br/>false | Indicates whether or not to pull files from subdirectories |

### Relationships

| Name | Description |
|---------|----------------------------------------------|
| success | FlowFiles are transferred here after logging |
| Name | Description |
|---------|--------------------------------------------|
| success | The created FlowFiles are transferred here |

### Output Attributes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,26 @@
use crate::controller_services::animal_controller_apis::{
CanFlyControllerApi, NumberOfLegsControllerApi,
};
use minifi_native::ControllerServiceApi;
use minifi_native::macros::ComponentIdentifier;
use minifi_native::{
ControllerServiceDefinition, EnableControllerService, GetProperty, Logger, MinifiError,
Property, ProvidedInterface, StandardPropertyValidator, create_provided_interface,
ControllerServiceApi, ControllerServiceDefinition, EnableControllerService, GetProperty,
Logger, MinifiError, Property, PropertyDefinition, ProvidedInterface,
create_provided_interface, property_definitions,
};

pub(crate) const HAS_JETPACK: Property = Property {
name: "Has Jetpack",
description: "Whether or not the dog has a jetpack",
is_required: true,
is_sensitive: false,
supports_expr_lang: false,
default_value: Some("false"),
validator: StandardPropertyValidator::BoolValidator,
allowed_values: &[],
allowed_type: None,
};
pub(crate) const HAS_JETPACK: Property<bool> =
Property::new("Has Jetpack", "Whether or not the dog has a jetpack").with_default("false");

pub(crate) const EXTRA_INFO: Property = Property {
name: "Extra information",
description: "We need this to verify the casting was done correctly",
is_required: false,
is_sensitive: false,
supports_expr_lang: false,
default_value: None,
validator: StandardPropertyValidator::AlwaysValidValidator,
allowed_values: &[],
allowed_type: None,
};
pub(crate) const EXTRA_INFO: Property<Option<String>> = Property::new(
"Extra information",
"We need this to verify the casting was done correctly",
);

#[allow(dead_code)] // extra_info is only used by {:?}
#[derive(Debug, ComponentIdentifier)]
pub(crate) struct DogControllerRs {
has_jetpack: bool,
extra_info: String,
extra_info: Option<String>,
}

impl NumberOfLegsControllerApi for DogControllerRs {
Expand All @@ -73,11 +57,8 @@ impl EnableControllerService for DogControllerRs {
where
Self: Sized,
{
let has_jetpack = context.get_bool_property(&HAS_JETPACK)?.ok_or(
MinifiError::missing_required_property("Has jetpack is required"),
)?;

let extra_info = context.get_property(&EXTRA_INFO)?.unwrap_or("".into());
let has_jetpack = context.get_property(&HAS_JETPACK)?;
let extra_info = context.get_property(&EXTRA_INFO)?;

Ok(Self {
has_jetpack,
Expand All @@ -88,7 +69,8 @@ impl EnableControllerService for DogControllerRs {

impl ControllerServiceDefinition for DogControllerRs {
const DESCRIPTION: &'static str = "RUST TEST CONTROLLER SERVICE: DogControllerRs";
const PROPERTIES: &'static [Property] = &[HAS_JETPACK, EXTRA_INFO];
const PROPERTIES: &'static [PropertyDefinition] =
property_definitions![HAS_JETPACK, EXTRA_INFO];
const PROVIDED_APIS: &'static [ProvidedInterface<Self>] = &[
create_provided_interface!(dyn CanFlyControllerApi),
create_provided_interface!(dyn NumberOfLegsControllerApi),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use minifi_native::ControllerServiceApi;
use minifi_native::macros::ComponentIdentifier;
use minifi_native::{
ControllerServiceDefinition, EnableControllerService, GetProperty, Logger, MinifiError,
Property, ProvidedInterface, create_provided_interface,
PropertyDefinition, ProvidedInterface, create_provided_interface,
};

#[derive(Debug, ComponentIdentifier)]
Expand Down Expand Up @@ -51,7 +51,7 @@ impl EnableControllerService for DuckControllerRs {

impl ControllerServiceDefinition for DuckControllerRs {
const DESCRIPTION: &'static str = "RUST TEST CONTROLLER SERVICE: DuckControllerRs";
const PROPERTIES: &'static [Property] = &[];
const PROPERTIES: &'static [PropertyDefinition] = &[];
const PROVIDED_APIS: &'static [ProvidedInterface<Self>] = &[
create_provided_interface!(dyn CanFlyControllerApi),
create_provided_interface!(dyn NumberOfLegsControllerApi),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use minifi_native::macros::ComponentIdentifier;
use minifi_native::{
ControllerServiceDefinition, EnableControllerService, GetProperty, Logger, MinifiError,
Property, ProvidedInterface,
PropertyDefinition, ProvidedInterface,
};

#[derive(Debug, ComponentIdentifier)]
Expand All @@ -35,6 +35,6 @@ impl EnableControllerService for DummyControllerService {

impl ControllerServiceDefinition for DummyControllerService {
const DESCRIPTION: &'static str = "RUST TEST CONTROLLER SERVICE: Dummy Controller Service";
const PROPERTIES: &'static [Property] = &[];
const PROPERTIES: &'static [PropertyDefinition] = &[];
const PROVIDED_APIS: &'static [ProvidedInterface<Self>] = &[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,11 @@ use lipsum::lipsum;
use minifi_native::macros::ComponentIdentifier;
use minifi_native::{
ControllerServiceDefinition, EnableControllerService, GetProperty, Logger, MinifiError,
Property, ProvidedInterface, StandardPropertyValidator,
Property, PropertyDefinition, ProvidedInterface, property_definitions,
};

const LENGTH: Property = Property {
name: "Length",
description: "How many words to generate",
is_required: true,
is_sensitive: false,
supports_expr_lang: false,
default_value: Some("25"),
validator: StandardPropertyValidator::U64Validator,
allowed_values: &[],
allowed_type: None,
};
const LENGTH: Property<usize> =
Property::new("Length", "How many words to generate").with_default("25");

#[derive(Debug, ComponentIdentifier)]
pub(crate) struct LoremIpsumControllerService {
Expand All @@ -44,17 +35,13 @@ impl EnableControllerService for LoremIpsumControllerService {
where
Self: Sized,
{
let length = context
.get_u64_property(&LENGTH)?
.ok_or(MinifiError::missing_required_property("Length is required"))?;

let data = lipsum(length as usize);
let data = lipsum(context.get_property(&LENGTH)?);
Ok(Self { data })
}
}

impl ControllerServiceDefinition for LoremIpsumControllerService {
const DESCRIPTION: &'static str = "RUST TEST CONTROLLER SERVICE: Holds generated lorem ipsum";
const PROPERTIES: &'static [Property] = &[LENGTH];
const PROPERTIES: &'static [PropertyDefinition] = property_definitions![LENGTH];
const PROVIDED_APIS: &'static [ProvidedInterface<Self>] = &[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

use crate::processors::asciify_german::AsciifyGerman;
use minifi_native::{
OutputAttribute, ProcessorDefinition, ProcessorInputRequirement, Property, Relationship,
OutputAttribute, ProcessorDefinition, ProcessorInputRequirement, PropertyDefinition,
Relationship,
};

impl ProcessorDefinition for AsciifyGerman {
Expand All @@ -28,5 +29,5 @@ impl ProcessorDefinition for AsciifyGerman {
const OUTPUT_ATTRIBUTES: &'static [OutputAttribute] = &[];
const RELATIONSHIPS: &'static [Relationship] =
&[super::relationships::SUCCESS, super::relationships::FAILURE];
const PROPERTIES: &'static [Property] = &[];
const PROPERTIES: &'static [PropertyDefinition] = &[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use minifi_native::macros::ComponentIdentifier;
use minifi_native::{
GetProperty, Logger, MinifiError, MutTrigger, OnTriggerResult, OutputAttribute, ProcessContext,
ProcessSession, ProcessorDefinition, ProcessorInputRequirement, Property, Relationship,
Schedule, debug, info, trace,
ProcessSession, ProcessorDefinition, ProcessorInputRequirement, PropertyDefinition,
Relationship, Schedule, debug, info, trace,
};

#[derive(Debug, ComponentIdentifier)]
Expand Down Expand Up @@ -72,5 +72,5 @@ impl ProcessorDefinition for CountActualLogging {
const SUPPORTS_DYNAMIC_RELATIONSHIPS: bool = false;
const OUTPUT_ATTRIBUTES: &'static [OutputAttribute] = &[];
const RELATIONSHIPS: &'static [Relationship] = &[];
const PROPERTIES: &'static [Property] = &[];
const PROPERTIES: &'static [PropertyDefinition] = &[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use minifi_native::macros::ComponentIdentifier;
use minifi_native::{
GetAttribute, GetControllerService, GetProperty, InputStream, Logger, MinifiError,
MutFlowFileStreamTransform, OutputAttribute, OutputStream, ProcessorDefinition,
ProcessorInputRequirement, Property, Relationship, Schedule, TransformStreamResult,
ProcessorInputRequirement, PropertyDefinition, Relationship, Schedule, TransformStreamResult,
};
use std::collections::HashMap;

Expand Down Expand Up @@ -67,5 +67,5 @@ impl ProcessorDefinition for DuplicateStreamText {
const SUPPORTS_DYNAMIC_RELATIONSHIPS: bool = false;
const OUTPUT_ATTRIBUTES: &'static [OutputAttribute] = &[];
const RELATIONSHIPS: &'static [Relationship] = &[SUCCESS];
const PROPERTIES: &'static [Property] = &[];
const PROPERTIES: &'static [PropertyDefinition] = &[];
}
Loading
Loading