Majid Hajibaba
Majid Hajibaba

Reputation: 3270

How can I read json from ListenTCP on Nifi

I have a TCP client which writes JSON strings over a TCP port. I added a ListenTCP processor to read data over socket and write it to file (by PutFile processor). enter image description here But when client write JSON in its side as follow:

{
  "id" : "faa4e780-3221-4260-89e6-e46721c4a42a",
  "type" : "Scroll",
  "timestamp" : "2022-04-12 16:45:53",
  "app" : "App-3"
}
{
  "id" : "faa4e780-3221-4260-89e6-e46721c4a42a",
  "type" : "Scroll",
  "timestamp" : "2022-04-12 16:45:53",
  "app" : "App-3"
}

the result will split line by line in ListenTCP and each output is a flow file containing a line not the whole JSON message.

How can I detect a Json object over socket in NiFi.

Upvotes: 0

Views: 326

Answers (1)

daggett
daggett

Reputation: 28634

there is a parameter

Batching Message Delimiter = \n

set it to something else

Upvotes: 0

Related Questions