Skip to content

Instantly share code, notes, and snippets.

View NiteshKant's full-sized avatar

Nitesh Kant NiteshKant

View GitHub Profile
@NiteshKant
NiteshKant / ByteBufPipelineConfigurator.java
Last active August 29, 2015 13:56
RxNetty-ByteBufConfigurator
package io.reactivex.netty.pipeline;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise;
/**
* @author Nitesh Kant
@NiteshKant
NiteshKant / HttpAwesomeServer.java
Created April 29, 2014 04:19
A URI based router for RxNetty, How Awesome :)
package io.reactivex.netty.examples.java;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.handler.codec.http.HttpHeaders;
import io.reactivex.netty.RxNetty;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import io.reactivex.netty.protocol.http.server.RequestHandler;
import io.reactivex.netty.protocol.text.sse.ServerSentEvent;
@NiteshKant
NiteshKant / TestMe.java
Created May 20, 2014 01:35
TestingTakeUntilAndRetry
package io.reactivex.netty.examples.java;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.subscriptions.SerialSubscription;
import java.util.concurrent.TimeUnit;
@NiteshKant
NiteshKant / Http10Server.java
Created May 29, 2014 07:23
Http 1.0 Server used for Apache Bench
/*
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@NiteshKant
NiteshKant / Hystrix.java
Last active August 29, 2015 14:02
Ribbon proposed interaction model
public @interface Hystrix {
String name();
Class<? extends FallbackProvider<?>> fallback();
// How do we represent the config?
interface FallbackProvider<T> extends Func1<HystrixCommand<T>, Observable<? extends T>> {
@NiteshKant
NiteshKant / Ribbon.java
Created June 10, 2014 06:24
Ribbon api design
package com.netflix.client.netty;
import io.netty.buffer.ByteBuf;
import io.reactivex.netty.protocol.http.client.HttpClient;
/**
* @author Nitesh Kant
*/
public final class Ribbon {
@NiteshKant
NiteshKant / InterceptorExecutor.java
Created June 28, 2014 00:03
async filter chain
package com.netflix.karyon.transport.interceptor;
import com.netflix.karyon.transport.RequestRouter;
import rx.Observable;
import rx.Subscriber;
import rx.subscriptions.SerialSubscription;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/*
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package com.netflix.karyon.examples.simpleroute;
import com.google.inject.binder.AnnotatedBindingBuilder;
import com.netflix.governator.annotations.Modules;
import com.netflix.karyon.KaryonBootstrap;
import com.netflix.karyon.KaryonServer;
import com.netflix.karyon.archaius.ArchaiusBootstrap;
import com.netflix.karyon.examples.hellonoss.server.health.HealthCheck;
import com.netflix.karyon.transport.http.AbstractHttpModule;
import com.netflix.karyon.transport.http.HttpRequestRouter;
@NiteshKant
NiteshKant / UnicastContentSubject.java
Created August 18, 2014 17:52
UnicastContentSubject
/*
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software