Hello, and welcome!

1) If you want to create a flow file and write data to it you would need to
do something like the following:

FlowFile flowFile = session.create();

flowFile = session.write(flowFile, new OutputStreamCallback() {
  @Override
  public void process(InputStream in, OutputStream out) throws IOException {
    try (OutputStream outputStream = new BufferedOutputStream(out)) {
      outputStream.write(...);
    }
  }};

session.transfer(SOME_RELATIONSHIP, flowFile);

Of course you could use session.append() depending what you want to do.

2) By default each processor is scheduled with a run schedule of 0 seconds,
which means as fast as possible.
If you go into the scheduling tab of the processor you can select the
appropriate scheduling strategy.

-Bryan


On Wed, Oct 19, 2016 at 2:48 AM, Arsalan Siddiqi <[email protected]>
wrote:

> Hi
> I am new to Nifi. I am trying to read data from a cache and then create a
> new flow file and write the contents of the cache to the Flowfiles content.
> Firstly no flow file is created when I run my processor. As in the code i
> am
> looping over an array, I think i need to use the append function to append
> the contents to the flow file. At the moment I am guessing it is just
> overwriting the contents with the latest object of the array. At the moment
> I just want it to create a file with some content and then later I can
> figure out how i can manipulate it.
>
> Another thing is how can i schedule the processor to run only once. At
> first
> I had a log info statement inside the while loop and i see that even when I
> run the processor for a second, the log info runs over 100000 times. The
> number of entries in the cache are 300 so I know that the loop will run 300
> times, thus printing the log info at least 300 times, but how to i make it
> execute only once.
>
> <http://apache-nifi-developer-list.39713.n7.nabble.com/file/
> n13654/writeavro.png>
>
>
>
> --
> View this message in context: http://apache-nifi-developer-
> list.39713.n7.nabble.com/Creating-and-Writing-to-an-Avro-File-tp13654.html
> Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
>

Reply via email to