title: what happen to the messages when connection is down between kafka server and producer?
body: <p>i m new in kafka using spring boot and i m working in projet that i want to integrate kafka using spring into it ,
  so the problem is i want to send message from the producer to the consumer even if <strong>the kafka server don't running</strong>(offline mode)</p>
  
  <p>Can anyone give me example of how using kafka in offline mode ,
  i can't find a tuto for this topic 
  i want to stop my kafka server(for example) and in the same time producer want to send data to the topic,then the consumer can get these message?
  what's the best solution?are they true ?</p>
  
  <p>*sending data to a file, and when the server return to run (i test connexion for example),i export data from the file to the topic</p>
  
  <p>*sending data to database and when the server return to run (test connexion),the same i send message(data) from database to my topic</p>
  
  <p>*using a queue or a list to store message and when the server return to run (test connexion),i send data from the list to the topic but the problem that i have a lot of messages</p>
  
  <p>-->if there are other solution with a simple example ,can anyone help me?</p>
  
  <p>this is example of brocker <strong>Redis</strong> that we test the connection between Redis brocker and producer , if connection fails, i will store data inside a <strong>Queue</strong> which can store many messages, and when connection return to work between Redis and producer ,the producer now get these messages from the Queue and send them to the Redis Brocker .</p>
  
  <p>But the problem in this brocker ,there are a few message lost
  so we decide to integrate kafka brocker inside my project instead of Redis brocker!</p>
  
  <p>Can anyone give me example in java how to store a lot of message before sending them by producer to kafka cluster?or what's the best solution to this problem  because we don't want to use the same Queue solution?</p>
  
  <p>this example in python is how store message inside a Queue if connexion failed to the server:</p>
  
  <pre><code>    try:
      urllib.request.urlopen('http://serverAdress', timeout=0.1)
      r.publish(topicProduction,json_background_of_message1)
      print(json_background_of_message1)
      arretControle=Tru
      except Exception as e:
      qArret.put(json_background_of_message1)
      print("arret")
      arretControle=True
  </code></pre>
  
  <p>//json_background_of_message1 is the Queue that we can store a lot of messages in this Queue before sending these message if the connexion is failed</p>