title: Kafka Best Way to Filter Messages
body: <p>One application (producer) is publishing messages and these messages are being consumed by another application (with multiple consumers). Producer sends data with field country and we will have multiple consumers in our application, each consumer will subscribe to specific country.</p>
  <p>From what I have been reading so far, we can have 2 approaches to filter message:</p>
  <ol>
  <li>Filter data on consumer side: Producer can add country in message
  header. Consumer will receive all data and filter country it needs by checking
  from message header. Not sure if we can/should have multiple Consumers with different filters on different countries? Or just one Consumer that filters out the list of countries and we do aggregation by countries on our own?</li>
  <li>One topic with separate partition for separate
  country: We will have a custom partitioner on Producer so it can send
  message to a specific partition. Consumers will be directed to the
  right partition for consuming country specific message.</li>
  </ol>
  <p>My question is should we choose option 1 or 2? We are expecting to receive hundreds of messages every few seconds.</p>