分享

kafka中文文档

 
xuanxufeng 2016-12-21 09:41:56 发表于 文档 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 245 84715
neeson 发表于 2018-6-2 09:32:33
感谢楼主分享~
回复

使用道具 举报

从前有座山 发表于 2018-6-23 18:24:17
public static void main(String[] args) throws Exception {
        Properties props = new Properties();
        //设置代理\服务器地址
        props.put("metadata.broker.list", "s102:9092, s103:9092, s104:9092");
        //序列化类,string
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        //包装java的prop,包装成ProducerConfig
        ProducerConfig config = new ProducerConfig(props);
        //使用producerConfig初始化producer
        //<String, String> 中第一个为key类型(未接触到),第二个是value类型,真实数据
        Producer<String, String> producer = new Producer<String, String>(config);

        String topic = "t3";
        for (int i = 1000; i < 2000; i++) {
            KeyedMessage<String, String> data = new KeyedMessage<String, String>(topic, "tom" + i);
            producer.send(data);
            Thread.sleep(500);
        }
        producer.close();
    }
回复

使用道具 举报

进击的阿飞 发表于 2018-8-20 16:41:38
楼主辛苦,学习学习、、、、、
回复

使用道具 举报

zhouxt_love 发表于 2018-9-3 19:27:20
感谢楼主分享
回复

使用道具 举报

1573 发表于 2018-10-15 09:52:30
kan看 ,正需要文档查
回复

使用道具 举报

fuyaosuixin 发表于 2018-12-3 10:53:19
好好学习 天天向上

回复

使用道具 举报

aidaren 发表于 2018-12-18 11:05:00
xiexieiixxiexie
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条