FLaNK-TravelAdvisory
Tags: apachenifi, clouderdataflow
Published: 2023-06-05 15:00:31

---
title: FLaNK-TravelAdvisory
published: true
date: 2023-05-03 20:23:00 UTC
tags: apachenifi,clouderdataflow
canonical_url: 
---

 

# FLaNK-TravelAdvisory

Travel Advisory - RSS Processing - Apache NiFi - Apache Kafka - Apache Flink - SQL

## [<svg aria-hidden="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/steps.md#overview)Overview

[![overview](https://raw.githubusercontent.com/tspannhw/FLaNK-TravelAdvisory/main/images/traveladvisory.png)](https://raw.githubusercontent.com/tspannhw/FLaNK-TravelAdvisory/main/images/traveladvisory.png)

## [<svg aria-hidden="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/steps.md#final-flow)Final Flow

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/cloudflow/nififlow1.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/cloudflow/nififlow1.jpg)

## [<svg aria-hidden="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/steps.md#adding-processors-to-the-designer)Adding Processors to the Designer

Here I list most of the processors available

[https://www.datainmotion.dev/2023/04/dataflow-processors.html](https://dev.to/tspannhw/dataflow-processors-cheat-sheet-28eo-temp-slug-6808800)

## [<svg aria-hidden="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/steps.md#flow-parameters)Flow Parameters

Go to parameters and enter all you will need for the flow.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/gotoparameters.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/gotoparameters.jpg)

You can add all the ones listed below.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/parameterslist.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/parameterslist.jpg)

## [<svg aria-hidden="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/steps.md#flow-walk-through)Flow Walk Through

If you are loading my pre-built flow when you enter you will see the details for the process group in the configuration pallet.

We add an invokeHTTP processor and set the parameters.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step1.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step1.jpg)

[![details](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step1b.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step1b.jpg)

Now we can add a parameter for the HTTP URL for Travel Advisories.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step2.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step2.jpg)

Connect InvokeHTTP to QueryRecord. Name your connection for monitoring later.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step3.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step3.jpg)

QueryRecord, convert XML(RSS) to JSON, you will need RSSXMLReader and TravelJsonRecordSetWriter.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step4.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step4.jpg)

Connect QueryRecord to SplitJson if no errors.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step5.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step5.jpg)

SplitJson we set the JsonPath Expression to `$.*.*.item`

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step6.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step6.jpg)

We then connect SplitJson to SplitRecord.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step7.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step7.jpg)

For SplitRecord we set the Record Reader to JSON\_Reader\_InferRoot, the Record Writer to TravelJsonRecordSetWriter and records per split to 1.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step8.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step8.jpg)

SplitRecord connected to EvaluateJSONPath

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step9.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step9.jpg)

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step9b.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step9b.jpg)

We set the Destination to flowfile-attribute, Return Type to json and add several new fields.

- description - $.description
- guid - $.guid
- identifier - $.identifier
- link - $.link
- pubdate - $.pubDate
- title - $.title

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step10.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step10.jpg)

We connect EvaluateJsonPath to SplitJson.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step11.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step11.jpg)

For SplitJson we set the JsonPath Expression to $.category

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step12.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step12.jpg)

From SplitJson to UpdateRecord

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step14.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step14.jpg)

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step14b.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step14b.jpg)

In UpdateRecord, we set Record Reader to JSON\_Reader\_InferRoot and Record Writer to TravelJsonRecordSetWriter. We set Replacement Value Strategy to Literal Value.

We add new fields for our new record format.

- /advisoryId - ${filename}
- /description - ${description}
- /domain - ${identifier:trim()}
- /guid - ${guid}
- /link - ${link}
- /pubdate - ${pubdate}
- /title - ${title}
- /ts - ${now():toNumber()}
- /uuid - ${uuid}

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step15.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step15.jpg)

Next we connect UpdateRecord to our Slack Sub-Processor Group

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step16.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step16.jpg)

The other branches flows from UpdateRecord to Write to Kafka

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step17.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step17.jpg)

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step17b.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step17b.jpg)

For PublishKafka2RecordCDP, there's a lot of parameters to set. This is why we recommend starting with a ReadyFlow.

There are a lot of parameters here, we need to set our Kafka Brokers, Destination Topic Name, JSON\_Reader\_InferRoot for Reader, AvroRecordSetWriterHWX for writer, turn transactions off, Guarantee Replicated Delivery, Use Content as Record Value, SASL\_SSL/Plain security, Username to your login user id or machine user and then the associated password, the SSL Context maps to the Default NiFi SSL Context Service is built in, set uuid as the Message Key Field and finally set the client.id to a unique Kafka producer id.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step18.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step18.jpg)

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step19.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step19.jpg)

We then send messages also to Slack about our travel advisories.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step20slackgroupinside.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step20slackgroupinside.jpg)

We only need one processor to send to slack.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step21.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step21.jpg)

We connect input to our PutSlack processor.

[![overview](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/step22PutSlack.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/step22PutSlack.jpg)

For PutSlack we need to set the Webhook URL to the one from your Slack group admin and put the text from the ingest, set your channel to the channel mapped in the web hook and set a username for your bot.

## [<svg aria-hidden="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/steps.md#flow-services)Flow Services

[![services](https://github.com/tspannhw/FLaNK-TravelAdvisory/raw/main/images/slack/services.jpg)](https://github.com/tspannhw/FLaNK-TravelAdvisory/blob/main/images/slack/services.jpg)

All these services need to be set.

@copy; 2023 Tim Spann [https://datainmotion.dev/](https://datainmotion.dev/)