@Stateful(scopes = Scope.CLUSTER, description = "Mock for QueryDatabaseTableRecord processor") private static class MockQueryDatabaseTableRecord extends QueryDatabaseTableRecord { void putColumnType(String colName, Integer colType) { columnTypeMap.put(colName, colType); } } }
/** * Write the description of the Stateful annotation if provided in this component. * * @param configurableComponent the component to describe * @param xmlStreamWriter the stream writer to use * @throws XMLStreamException thrown if there was a problem writing the XML */ private void writeStatefulInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException { final Stateful stateful = configurableComponent.getClass().getAnnotation(Stateful.class); writeSimpleElement(xmlStreamWriter, "h3", "State management: "); if(stateful != null) { xmlStreamWriter.writeStartElement("table"); xmlStreamWriter.writeAttribute("id", "stateful"); xmlStreamWriter.writeStartElement("tr"); writeSimpleElement(xmlStreamWriter, "th", "Scope"); writeSimpleElement(xmlStreamWriter, "th", "Description"); xmlStreamWriter.writeEndElement(); xmlStreamWriter.writeStartElement("tr"); writeSimpleElement(xmlStreamWriter, "td", join(stateful.scopes(), ", ")); writeSimpleElement(xmlStreamWriter, "td", stateful.description()); xmlStreamWriter.writeEndElement(); xmlStreamWriter.writeEndElement(); } else { xmlStreamWriter.writeCharacters("This component does not store state."); } }
public MockStateManager(final Object component) { final Stateful stateful = component.getClass().getAnnotation(Stateful.class); if (stateful == null) { usesLocalState = false; usesClusterState = false; } else { final Scope[] scopes = stateful.scopes(); boolean local = false; boolean cluster = false; for (final Scope scope : scopes) { if (scope == Scope.LOCAL) { local = true; } else if (scope == Scope.CLUSTER) { cluster = true; } } usesLocalState = local; usesClusterState = cluster; } }
/** * Gets the description of the state this component persists. * * @param componentClass the component class * @return state description */ private String getStateDescription(final Class<?> componentClass) { final Stateful capabilityDesc = componentClass.getAnnotation(Stateful.class); if (capabilityDesc != null) { return capabilityDesc.description(); } else { return null; } }
public MockStateManager(final Object component) { final Stateful stateful = component.getClass().getAnnotation(Stateful.class); if (stateful == null) { usesLocalState = false; usesClusterState = false; } else { final Scope[] scopes = stateful.scopes(); boolean local = false; boolean cluster = false; for (final Scope scope : scopes) { if (scope == Scope.LOCAL) { local = true; } else if (scope == Scope.CLUSTER) { cluster = true; } } usesLocalState = local; usesClusterState = cluster; } }
@Stateful(scopes = Scope.CLUSTER, description = "Mock for QueryDatabaseTable processor") private static class MockQueryDatabaseTable extends QueryDatabaseTable { void putColumnType(String colName, Integer colType) { columnTypeMap.put(colName, colType); } } }
@Override protected void writeStatefulInfo(final Stateful stateful) throws IOException { writeStartElement("stateful"); if (stateful != null) { writeTextElement("description", stateful.description()); writeArray("scopes", Arrays.asList(stateful.scopes()), scope -> writeTextElement("scope", scope.name())); } writeEndElement(); }
@Stateful(scopes = {Scope.LOCAL, Scope.CLUSTER}, description = "After a listing of resources is performed, the latest timestamp of any of the resources is stored in the component's state. " + "The scope used depends on the implementation.") public abstract class AbstractListProcessor<T extends ListableEntity> extends AbstractProcessor {
@Tags({"Apache", "Solr", "Get", "Pull", "Records"}) @InputRequirement(Requirement.INPUT_FORBIDDEN) @CapabilityDescription("Queries Solr and outputs the results as a FlowFile in the format of XML or using a Record Writer") @Stateful(scopes = {Scope.CLUSTER}, description = "Stores latest date of Date Field so that the same data will not be fetched multiple times.") public class GetSolr extends SolrProcessor {
@Tags({"provenance", "lineage", "tracking", "site", "site to site"}) @CapabilityDescription("Publishes Provenance events using the Site To Site protocol.") @Stateful(scopes = Scope.LOCAL, description = "Stores the Reporting Task's last event Id so that on restart the task knows where it left off.") @Restricted( restrictions = {
" in addition to NiFi provenance events providing detailed event level lineage." + " See 'Additional Details' for further description and limitations.") @Stateful(scopes = Scope.LOCAL, description = "Stores the Reporting Task's last event Id so that on restart the task knows where it left off.") @DynamicProperty(name = "hostnamePattern.<ClusterName>", value = "hostname Regex patterns", description = RegexClusterResolver.PATTERN_PROPERTY_PREFIX_DESC, expressionLanguageScope = ExpressionLanguageScope.VARIABLE_REGISTRY)
@Stateful(scopes = {Scope.LOCAL, Scope.CLUSTER}, description = "Scripts can store and retrieve state using the State Management APIs. Consult the State Manager section of the Developer's Guide for more details.") @SeeAlso({InvokeScriptedProcessor.class})
expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES, description = "Updates a script engine property specified by the Dynamic Property's key with the value specified by the Dynamic Property's value") @Stateful(scopes = {Scope.LOCAL, Scope.CLUSTER}, description = "Scripts can store and retrieve state using the State Management APIs. Consult the State Manager section of the Developer's Guide for more details.") @SeeAlso({ExecuteScript.class})
@WritesAttribute(attribute = ROLLING_WINDOW_MEAN_KEY, description = "The mean of the FlowFiles seen in the rolling window.") }) @Stateful(scopes = {Scope.LOCAL}, description = "Store the values backing the rolling window. This includes storing the individual values and their time-stamps or the batches of values and their " + "counts.") public class AttributeRollingWindow extends AbstractProcessor {
@WritesAttribute(attribute = "mime.type", description = "The MIME Type of the FlowFile, as reported by the HTTP Content-Type header") }) @Stateful(scopes = {Scope.LOCAL}, description = "Stores Last Modified Time and ETag headers returned by server so that the same data will not be fetched multiple times.") public class GetHTTP extends AbstractSessionFactoryProcessor {
@WritesAttribute(attribute="splunk.latest.time", description = "The value of the latest time that was used when performing the query.") }) @Stateful(scopes = Scope.CLUSTER, description = "If using one of the managed Time Range Strategies, this processor will " + "store the values of the latest and earliest times from the previous execution so that the next execution of the " + "can pick up where the last execution left off. The state will be cleared and start over if the query is changed.")
@WritesAttribute(attribute = "mime.type", description = "Set to application/json to indicate that output is JSON") }) @Stateful(scopes = Scope.CLUSTER, description = "After performing a fetching from HBase, stores a timestamp of the last-modified cell that was found. In addition, it stores the ID of the row(s) " + "and the value of each cell that has that timestamp as its modification date. This is stored across the cluster and allows the next fetch to avoid duplicating data, even if this Processor is " + "run on Primary Node only and the Primary Node changes.")
+ "with the default value of 0 secs, as this Processor will consume a lot of resources if scheduled very aggressively. At this time, this Processor does not support " + "ingesting files that have been compressed when 'rolled over'.") @Stateful(scopes = {Scope.LOCAL, Scope.CLUSTER}, description = "Stores state about where in the Tailed File it left off so that on restart it does not have to duplicate data. " + "State is stored either local or clustered depend on the <File Location> property.") @WritesAttribute(attribute = "tailfile.original.path", description = "Path of the original file the flow file comes from.")
description = "Updates a FlowFile attribute specified by the Dynamic Property's key with the value specified by the Dynamic Property's value") @WritesAttribute(attribute = "See additional details", description = "This processor may write or remove zero or more attributes as described in additional details") @Stateful(scopes = {Scope.LOCAL}, description = "Gives the option to store values not only on the FlowFile but as stateful variables to be referenced in a recursive manner.") public class UpdateAttribute extends AbstractProcessor implements Searchable {
expressionLanguageScope = ExpressionLanguageScope.VARIABLE_REGISTRY, description = "Adds the specified property name/value as a query parameter in the Elasticsearch URL used for processing") @Stateful(description = "After each successful scroll page, the latest scroll_id is persisted in scrollId as input for the next scroll call. " + "Once the entire query is complete, finishedQuery state will be set to true, and the processor will not execute unless this is cleared.", scopes = { Scope.LOCAL }) public class ScrollElasticsearchHttp extends AbstractElasticsearchHttpProcessor {