Package kafka.javaapi.consumer

Examples of kafka.javaapi.consumer.ConsumerConnector.shutdown()


      }

      @Override
      public void close() throws IOException
      {
        connector.shutdown();
      }
    };
  }

  @Override
View Full Code Here


      }

      @Override
      public void close() throws IOException
      {
        connector.shutdown();
      }
    };
  }
}
View Full Code Here

            for (MessageAndMetadata<byte[], byte[]> messageAndMetadata : stream)
                messages.add(new Message(messageAndMetadata));
        } catch (ConsumerTimeoutException ignore) {
        } finally {
            connector.commitOffsets();
            connector.shutdown();
        }

        return Response.ok(messages).build();
    }
View Full Code Here

        try {
            stream.iterator().next();
            fail();
        } catch (ConsumerTimeoutException e) {
            //this is expected
            consumer.shutdown();
        }
    }

    @Test
    public void testFileBasedQueuePartitionByKey() throws Exception {
View Full Code Here

        try {
            stream.iterator().next();
            fail();
        } catch (ConsumerTimeoutException e) {
            //this is expected
            consumer.shutdown();
        }
    }

    @Test
    public void testBlockingThreadPoolExecutor() {
View Full Code Here

        try {
            stream.iterator().next();
            fail();
        } catch (ConsumerTimeoutException e) {
            //this is expected
            consumer.shutdown();
        }
    }

    @Test
    public void testFileBasedQueuePartitionByKey() throws Exception {
View Full Code Here

        try {
            stream.iterator().next();
            fail();
        } catch (ConsumerTimeoutException e) {
            //this is expected
            consumer.shutdown();
        }
    }


    /** Tests backward compatability with old Kafka sink. */
 
View Full Code Here

        try {
            stream.iterator().next();
            fail(); // there should be no data left to consume
        } catch (ConsumerTimeoutException e) {
            //this is expected
            consumer.shutdown();
        }
    }


    @Test
View Full Code Here

                        while (iterator.hasNext()) {
                            String msg = iterator.next().message();
                            msg = msg == null ? "<null>" : msg;
                            System.out.println("got message" + msg);
                            if (msg.equals("SHUTDOWN")) {
                                consumer.shutdown();
                                return;
                            }
                            messagesReceived.add(msg);
                        }
                    }
View Full Code Here

                String msg = iterator.next().message();
                msg =  ( msg == null ? "<null>" : msg );
                System.out.println("got message" + msg);
                messagesReceived.add(msg);
                if (msg.contains("SHUTDOWN")) {
                    consumer.shutdown();
                    return messagesReceived;
                }
            }
        } catch (Exception e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.