Skip to content

Instantly share code, notes, and snippets.

@NiteshKant
Created June 10, 2014 06:24
Show Gist options
  • Save NiteshKant/6ed315fd717fbd9f5f01 to your computer and use it in GitHub Desktop.
Save NiteshKant/6ed315fd717fbd9f5f01 to your computer and use it in GitHub Desktop.
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 {
private Ribbon() {
}
public static <I, O> RibbonHttpClient<I, O> newHttpClient(HttpClient<I, O> transportClient) {
return null;
}
public static <I, O, T> T newHttpClient(Class<T> contract, HttpClient<I, O> transportClient) {
return null;
}
public static void main(String[] args) {
HttpClient<ByteBuf, ByteBuf> transportClient = RibbonTransport.newHttpClient("myclient");
Ribbon.newHttpClient(transportClient).newRequestTemplate()
.withUri("/{id}").supplier().withValue("id", 1).toRequest().execute();
}
}
package com.netflix.client.netty;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.ILoadBalancer;
import io.netty.buffer.ByteBuf;
import io.reactivex.netty.client.RxClient;
import io.reactivex.netty.protocol.http.client.HttpClient;
import io.reactivex.netty.protocol.udp.client.UdpClient;
/**
* @author Nitesh Kant
*/
public final class RibbonTransport {
private RibbonTransport() {
}
public static RxClient<ByteBuf, ByteBuf> newTcpClient(ILoadBalancer loadBalancer, IClientConfig config) {
return null;
}
public static RxClient<ByteBuf, ByteBuf> newTcpClient(String name) {
return null;
}
public static UdpClient<ByteBuf, ByteBuf> newUdpClient(ILoadBalancer loadBalancer, IClientConfig config) {
return null;
}
public static UdpClient<ByteBuf, ByteBuf> newUdpClient(String name) {
return null;
}
public static HttpClient<ByteBuf, ByteBuf> newHttpClient(ILoadBalancer loadBalancer, IClientConfig config) {
return null;
}
public static HttpClient<ByteBuf, ByteBuf> newHttpClient(String name) {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment