Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.72 KB

README.md

File metadata and controls

58 lines (44 loc) · 1.72 KB

Thrift API Gateway for Spring

Join the chat at https://gitter.im/aatarasoff/spring-thrift-api-gateway Build Status

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.0.0.RC1'

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

Enjoy!