Skip to content

Instantly share code, notes, and snippets.

View PandyYang's full-sized avatar

Pandy PandyYang

View GitHub Profile

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
package jichubiancheng;
import java.util.ArrayList;
/**
* @author Pandy
* @date 2018/5/13 16:18
*/
public class ApplesAndOrangesWithGenerics {
public static void main(String[] args){
package lianxi;
import java.util.*;
/**
* @author Pandy
* @date 2018/5/12 21:01
*/
public class RandomTest {
public static void main(String[] args){
Random rand = new Random();
System.out.println("rand.nextBoolean:" + rand.nextBoolean());
package cn.insist;
/**
* @author Pandy
* @date 2018/5/11 21:51
*/
public class Demo23232 {
public static void main(String[] args) {
//构建一个新分配的integer对象,它表示指定的int值
Integer i = new Integer(4);
package cn.insist;
/**
* 将基本数据类型转化成字符类型的三种方式
* 基本数据类型直接与""相连接即可
* 调用String的value方法
* 调用包装类中的toString方法
* @author Pandy
* @date 2018/5/11 21:45
*/
package justdo;
/**
* @author Pandy
* @date 2018/5/5 10:25
*/
public class Goods {
String brand;
double size;
double price;
package justdo;
import java.util.*;
/**
* @author Pandy
* @date 2018/5/5 11:12
*/
public class GoodsManager {
public static void main(String[] args) {
String[] brand = {"Lenove","ThinkPad","Apple"};
package justdo;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;
/**
* @author Pandy
* @date 2018/5/5 16:05
*/
package fkjy;
/**
* 如果构造器中有一个和成员变量重名的局部变量,又必须在构造器中访问这个被覆盖的局部变量
* 则必须使用this前缀
* 如果没有前缀 则调用的是成员变量
* @author Pandy
* @date 2018/4/27 21:46
*/
public class ThisInConstructor {
/**
* @author Pandy
* @date 2018/4/22 11:08
*/
//creating an array of nonprimitive objects
import java.util.*;
public class ArrayClassObj {
public static void main(String[] args) {
Random rand = new Random(47);
Integer[] a = new Integer[rand.nextInt(21)];//即使用new创建数组之后,它还是一个引用数组,知道知道通过创建新的integer元素