@Test public void testThriftKafkaProducer() { KafkaProducer<String, Domainsync> kafkaProducer = KafkaProducerFactory.getThriftKafkaProducer(); for (int i = 0; i < 10; i++) { Domainsync domainsync = new Domainsync(); domainsync.setDomain("sohusohu"); domainsync.setPassport("babyduncan" + i + "@qq.com"); domainsync.setSid(100000); domainsync.setType(0); kafkaProducer.send("testthrift", domainsync); } }
@Test public void testSend() throws Exception { for (int i = 0; i < 10; i++) { Domainsync domainsync = new Domainsync(); domainsync.setDomain("sohu"); domainsync.setPassport("babyduncan" + i + "@qq.com"); domainsync.setSid(100000); domainsync.setType(0); kafkaProducer.send("testthrift", domainsync); } System.out.println("done !!"); }