Skip to content

Instantly share code, notes, and snippets.

pluone /
Created December 4, 2018 06:38
Kafaka stream countdownlatch的方法替代了while true循环
public class Pipe {
public static void main(String[] args) {
Properties props = new Properties();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "streams-pipe");
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());
StreamsBuilder builder = new StreamsBuilder();"streams-plaintext-input").to("streams-pipe-output");
pluone / JWT
Created July 7, 2017 10:05 — forked from richardgill/JWT
JWT Example (Java)

#Login via HTTP JSON api to get JWT token

##Client does login request

POST, body: {username: 'richardgill', password: 'password'}

Server receives request. Takes credentials and checks they are correct.

Server uses secret key: "secretkey123!" to generate a jwt token. (Using jwt library)

public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.addScripts('schema.sql', 'data.sql')
pluone / gist:a5880266d638ecd0472a21339899aa83
Last active May 4, 2017 15:25
Json Enum serialization deserializtion
import java.util.HashMap;
import java.util.Map;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.type.TypeReference;
enum HelloEnum {