Commit ebad8722 authored by DaikiKaminari's avatar DaikiKaminari

[ADD] Apache Thrift test

parent 9c81255b
package com.example.calculator;
import com.example.calculator.handler.CalculatorServiceHandler;
import org.apache.thrift.procotol.*;
import org.apache.thrift.servicer.TServlet;
import org.springframework.boot.StringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.*;
import javax.servlet.Servlet;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class CalculatorApplication {
public static void main(String[] args) {
StringApplication.run(CalculatorApplication.class, args);
}
@Bean
public TProtocolfactory tProtocolFactory() {
return new TBinaryProtocol.Factory();
}
@Bean
public Servlet calculator(TProtocolFactory protocolFactory, CalculatorService handler) {
return new TServlet(new TCalculatorService.Processor< CalculatorServiceHandler> (handler), protocolFactory)
}
}
\ No newline at end of file
namespace cpp com.example.calculator
namespace d com.example.calculator
namespace java com.example.calculator
namespace php com.example.calculator
namespace perl com.example.calculator
namespace as3 com.example.calculator
enum TOperation {
ADD = 1,
SUBSTRACT = 2,
MULTIPLY = 3,
DIVIDE = 4
}
exception TDivisionByZeroException {
}
service TCalculatorService {
i32 calculate(1:i32 num1, 2:i32 num2, 3:TOperation op) throws (1:TDivisionByZeroException divisionByZero);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment