<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378746#M243654</link>
    <description>&lt;P&gt;I want to create a flow In NIFI where i want to consumer data from 3 Kafka topics and produce that data into 3 different Kafka topics . each topic should produce data into unique topic . for example -&amp;nbsp;&lt;/P&gt;&lt;P&gt;kafka topics 1&amp;nbsp; --&amp;gt;&amp;nbsp; produce to topic A&lt;BR /&gt;kafka topics 2 --&amp;gt; produce to topic B&lt;BR /&gt;kafka topics 3 --&amp;gt; produce to topic C&lt;/P&gt;&lt;P&gt;i want to use only one Consumer processor and one producer processor . Right now i am using 3 produce Kafka processor .&lt;/P&gt;&lt;P&gt;Can anyone suggest better approach to do so and in more optimized way.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="direct kafka .png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38872iC4BAEBE525212796/image-size/large?v=v2&amp;amp;px=999" role="button" title="direct kafka .png" alt="direct kafka .png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2023 09:50:12 GMT</pubDate>
    <dc:creator>Rohit1997jio</dc:creator>
    <dc:date>2023-11-08T09:50:12Z</dc:date>
    <item>
      <title>use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics</title>
      <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378746#M243654</link>
      <description>&lt;P&gt;I want to create a flow In NIFI where i want to consumer data from 3 Kafka topics and produce that data into 3 different Kafka topics . each topic should produce data into unique topic . for example -&amp;nbsp;&lt;/P&gt;&lt;P&gt;kafka topics 1&amp;nbsp; --&amp;gt;&amp;nbsp; produce to topic A&lt;BR /&gt;kafka topics 2 --&amp;gt; produce to topic B&lt;BR /&gt;kafka topics 3 --&amp;gt; produce to topic C&lt;/P&gt;&lt;P&gt;i want to use only one Consumer processor and one producer processor . Right now i am using 3 produce Kafka processor .&lt;/P&gt;&lt;P&gt;Can anyone suggest better approach to do so and in more optimized way.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="direct kafka .png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38872iC4BAEBE525212796/image-size/large?v=v2&amp;amp;px=999" role="button" title="direct kafka .png" alt="direct kafka .png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 09:50:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378746#M243654</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-11-08T09:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics</title>
      <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378751#M243658</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107711"&gt;@Rohit1997jio&lt;/a&gt;&amp;nbsp; &amp;nbsp;I do not think this is possible.&amp;nbsp; &amp;nbsp;You would need a method outside of the consume/produce that handles logic for which consume topic maps to which produce topic.&amp;nbsp; &amp;nbsp;Then you could use a dynamic topic name in the producer. However, you would still be limited in fact that ConsumeKafka doesnt take upstream connections.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example above,&amp;nbsp; if customerTopicX is attribute based, you can just use the same attribute logic in topic Name for&amp;nbsp; a single publishKafka versus three seen above.&amp;nbsp; That would atleast clean up your flow.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 15:33:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378751#M243658</guid>
      <dc:creator>steven-matison</dc:creator>
      <dc:date>2023-11-08T15:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics</title>
      <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378766#M243662</link>
      <description>&lt;P&gt;i tried using expression language . kafka.topic is the attribute which contains consumer topics. so i added if else condition for different consumer topic but the output was not the producer topic but whole string mentioned below&lt;/P&gt;&lt;P&gt;in update attribute added a property customerKafkaTopic=${kafka.topic:contains('alerts'):ifElse('${kafkaTopic1}',${kafka.topic:contains('events'):ifElse('${kafkaTopic2}',${kafka.topic:contains('ack'):ifElse('${kafkatopic3}','Not_found')}))}}&lt;/P&gt;&lt;P&gt;and passed this property&amp;nbsp;customerKafkaTopic in publish kafka but it is not working ,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 17:22:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378766#M243662</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-11-08T17:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics</title>
      <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378767#M243663</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;You would need a method outside of the consume/produce that handles logic for which consume topic maps to which produce topic.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;can you please elaborate it more , what method and what logic need to be there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 17:26:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/378767#M243663</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-11-08T17:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics</title>
      <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/379045#M243765</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;You would need a method outside of the consume/produce that handles logic for which consume topic maps to which produce topic.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;can you please elaborate it more , what method and what logic need to be there&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 06:57:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/379045#M243765</guid>
      <dc:creator>Rohit1997jio</dc:creator>
      <dc:date>2023-11-15T06:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: use only one consumer and producer processor in NIFI to pubish data to multiple kafka topics</title>
      <link>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/379064#M243771</link>
      <description>&lt;P&gt;In regards to your nifi expression language.:&amp;nbsp; &amp;nbsp; Test in a simple flow, and inspect the flowfile's attributes to insure topicName is correct.&amp;nbsp; &amp;nbsp; Then take it to the kafka processor.&amp;nbsp; If you are not seeing the results of the expression, something isnt right, or the value doesnt except Expression Language.&amp;nbsp; Look at the (?) on any property to see what is accepted.&amp;nbsp; &amp;nbsp;I suspect the expression language is invalid as well, so make sure you test and confirm the attribute is as expected before trying to use it deeper in your flow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In regards to mapping.&amp;nbsp; &amp;nbsp;What i suggest could be DistributedMapCache or even a flow that does a lookup against some other service.&amp;nbsp; With this concept you provide a mapping key value pairs that correspond to your consumer and producer topics.&amp;nbsp; When you lookup a key, For Example:&amp;nbsp; "alerts_Consumer_Topic_Name" the value would be "alerts_Producer_Topic_Name".&amp;nbsp; &amp;nbsp;If this is stored outside of nifi, then these values can be managed and changed outside of the scope of the nifi flow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example flow with DistributeMapCache:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/ds-steven-matison/NiFi-Templates/blob/main/DistributedCache_Demo.xml" target="_blank"&gt;https://github.com/ds-steven-matison/NiFi-Templates/blob/main/DistributedCache_Demo.xml&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 13:36:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/use-only-one-consumer-and-producer-processor-in-NIFI-to/m-p/379064#M243771</guid>
      <dc:creator>steven-matison</dc:creator>
      <dc:date>2023-11-15T13:36:56Z</dc:date>
    </item>
  </channel>
</rss>

