Skip to content

Instantly share code, notes, and snippets.

View spencergibb's full-sized avatar

Spencer Gibb spencergibb

View GitHub Profile
class FeignHystrixSample {
@HystrixCommand
Object myMethod() {
return myFeignClient.doStuff();
}
}
{
"request": {
"method": "GET",
"url": "/foo"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
@spencergibb
spencergibb / DomainValidator
Last active December 17, 2015 23:12
What URI thinks are valid hosts
import java.net.InetAddress;
import java.net.URI;
public class DomainValidator {
public static String[] hosts = new String[] {
"www.example.com",
"example",
"example9",
"example-dash",
@spencergibb
spencergibb / pom.xml
Created June 23, 2016 19:32
Zuul pom without actuator
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demozuulnoactuator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@spencergibb
spencergibb / application-broken.yml
Created February 6, 2017 19:51
Workaround for "MIME type may not contain reserved characters" with Spring Cloud Camden, Spring Boot 1.5 and zuul url routes. Raw
# if you have a content-type with an encoding, this will produce a "MIME type may not contain reserved characters".
zuul:
routes:
myservice:
url: http://httpbin.org:80
path: /get/**
@spencergibb
spencergibb / gateway.log
Created December 20, 2017 21:35
gateway with paranoid leak detection
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.BUILD-SNAPSHOT)
2017-12-20 16:30:35.808 INFO 25996 --- [ main] sample.load.ApplicationKt : Starting ApplicationKt on sgibb-precision-5520 with PID 25996 (/home/spencer/workspace/spring/boot2-load-demo/applications/spring-cloud-gateway-sample/build/libs/spring-cloud-gateway-sample-0.0.1-SNAPSHOT.jar started by spencer in /home/spencer/workspace/spring/boot2-load-demo)
2018-01-22 14:31:43.212 INFO 11521 --- [ hystrix-menu-1] c.netflix.config.ChainedDynamicProperty : Flipping property: menu.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2018-01-22 14:31:43.213 INFO 11521 --- [ hystrix-menu-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client menu initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=menu,current list of Servers=[192.168.2.115:3002],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:192.168.2.115:3002; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Wed Dec 31 19:00:00 EST 1969; First connection made: Wed Dec 31 19:00:00 EST 1969; Active Connections:0; total failure count in last (1000) msecs:0; average resp
@spencergibb
spencergibb / gateway.log
Last active April 2, 2018 20:54
Gateway errors
2018-04-02 16:24:04.041 DEBUG 14555 --- [ctor-http-nio-5] r.ipc.netty.channel.ChannelOperations : [HttpClient] [id: 0xee821ee3, L:/127.0.0.1:54402 - R:localhost/127.0.0.1:8883] handler is being applied: HttpClientHandler{startURI=http://localhost:8883/sample/tests/81, method=GET, handler=org.springframework.cloud.gateway.filter.NettyRoutingFilter$$Lambda$409/1967942115@3c6426d8}
2018-04-02 16:24:04.041 DEBUG 14555 --- [ctor-http-nio-5] r.ipc.netty.http.client.HttpClient : [id: 0xee821ee3, L:/127.0.0.1:54402 - R:localhost/127.0.0.1:8883] USER_EVENT: reactor.ipc.netty.NettyPipeline$SendOptionsChangeEvent@73ee8dae
2018-04-02 16:24:04.041 DEBUG 14555 --- [ctor-http-nio-5] r.i.n.channel.ChannelOperationsHandler : [id: 0xee821ee3, L:/127.0.0.1:54402 - R:localhost/127.0.0.1:8883] New sending options
2018-04-02 16:24:04.041 DEBUG 14555 --- [ctor-http-nio-5] r.i.n.channel.ChannelOperationsHandler : [id: 0xee821ee3, L:/127.0.0.1:54402 - R:localhost/127.0.0.1:8883] Writing object DefaultHttpRequest(decodeRe
@spencergibb
spencergibb / gateway-linux.log
Created April 20, 2018 17:31
spring cloud gateway 262 logs
/home/spencer/.sdkman/candidates/java/8u152-zulu/bin/java -Dvisualvm.id=711222280897947 -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=35575 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/home/spencer/apps/idea-IU-173.4127.27/lib/idea_rt.jar=40557:/home/spencer/apps/idea-IU-173.4127.27/bin -Dfile.encoding=UTF-8 -classpath /home/spencer/.sdkman/candidates/java/8u152-zulu/jre/lib/charsets.jar:/home/spencer/.sdkman/candidates/java/8u152-zulu/jre/lib/ext/cldrdata.jar:/home/spencer/.sdkman/candidates/java/8u152-zulu/jre/lib/ext/dnsns.jar:/home/spencer/.sdkman/candidates/java/8u152-zulu/jre/lib/ext/jaccess.jar:/home/spencer/.sdkman/candidates/java/8u152-zulu/jre/lib/ext/localedata.jar:/home/spencer/.sdkman/candidates/java/8u152-zulu/jre/lib/ext/nashorn.jar:/home
package com.example.demogatewaypathtoparam;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.http.server.reactive.ServerHttpRequest;