Skip to content

pm-hwks/nifi-generatejson-processor

Repository files navigation

nifi-generatejson-processor

A NiFi processor to generate JSON based on json-data-generator java library (https://github.com/acesinc/json-data-generator).

Build Status

Installation :

  1. Download the nar file from github release tab and drop it in the NiFi lib folder $NIFIROOT/lib/
  2. Restart NiFi to load the new processor

Usage

  1. Drag and drop the "GenerateJSON" processor into the NiFi Canvas

  2. Configure the processor and add following text to the "Custom Text" attribute. You can leave other attributes as is

    Note: This is a sample template. plz refer to "Workflow Steps" section here in https://github.com/acesinc/json-data-generator for more details

    { "timestamp": "nowTimestamp()", "system": "random('BADGE', 'AUDIT', 'WEB')", "actor": "bob", "action": "random('ENTER','LOGIN','EXIT', 'LOGOUT')", "objects": ["Building 1"], "location": { "lat": "double(-90.0, 90.0)", "lon": "double(-180.0, 180.0)" }, "message": "Entered Building 1" }

  1. Run the Flow
  1. Review the flow files

    Notice the random values generated for the system based on the inputs and differences

Flow File 1

Flow File 2

Build Notes

  1. Built & tested using JDK 1.8
  2. When using Intellij make sure the project SDK is pointing to JDK 1.8 otherwise the surefire tests may fail