You can set the "consumer.timeout.ms" to have a ConsumerTimeoutException thrown if the broker doesn't respond within that time period:

      var done = False
      val consumerIterator = initConsumer()
      while(true) {
        try {
          val messageAndMetadata = consumerIterator.next() // Blocks until a new message is available or timeout is reached
          val message = messageAndMetadata.message
          val offset = messageAndMetadata.offset
          System.out.println(new String(message, "UTF-8")) // For debugging purposes

          parseMessage( message, offset)
        }
        catch {
          case t: ConsumerTimeoutException => return
          case e => {
            println("unexpected exception: ")
            e.printStackTrace()
          }
        }
      } // End while loop

HTH,

Florin

On Jul 25, 2013, at 10:56 AM, Rob Withers <[EMAIL PROTECTED]> wrote:

 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB