spring-thrift-api-gateway
spring-thrift-api-gateway copied to clipboard
Gateway for Apache Thrift requests processing that is built on Spring Cloud stack
Thrift API Gateway for Spring
What it is about
Gateway for Apache Thrift requests processing that is built on Spring Cloud stack. Project depends on core functionality that is described in https://github.com/aatarasoff/thrift-api-gateway-core
How to connect the project
Its very simple:
repositories {
jcenter()
}
compile 'info.developerblog.spring.thrift:spring-thrift-api-gateway:1.5.0'
How to use this
Add annotations @EnableThriftClient and @EnableZuulProxy to your spring boot main application class
@SpringBootApplication
@EnableZuulProxy
@EnableThriftGateway
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Next you need to create AuthTokenExchanger implementation and register it as a bean
@Bean
AuthTokenExchanger authTokenExchanger() {
return new AuthTokenExchanger<Token, User>() {
@Override
public Token createEmptyAuthToken() {
return new Token();
}
@Override
public User process(Token authToken) throws TException {
// you token exchange logic
}
};
}
Last, you need configure Zuul with static routes or with dynamic cloud