Skip to content

haduart/Thrift-Docker-HelloWorld-with-Java-Spring-and-Python-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Working on localhost

Starting the Python Thrift Server

cd python-server-thrift/
source bin/activate
python PythonServer.py


Starting the Java Thrift Client, that is at the same time a REST Server.
cd java-client-thrift/
mvn clean install
mvn spring-boot:run


Testing it.

curl http://localhost:8080/hello

Java REST server is listening on port 8080, starts a thrift client and connects to the thirft server at port 9090.


Working with Docker-Compose

First Compiling the Java Client

cd java-client-thrift/
mvn clean install

Then using the docker-compose commands.

cd ../

docker-compose up -d
docker-compose ps
docker-compose logs -f

If you want to stop them
docker-compose down
And if you want to delete them completely
docker-compose down --rmi all --volumes


Working with Maven Docker Plugin
cd python-thrift-server/
docker run -p 9090:9090 --name python-thrift-server -d python-thrift-server:latest
cd ../

cd java-client-thrift/
mvn docker:build
docker run -d  -p 8080:8080 --name java-test-client -e PYTHON_THRIFT_PORT=9090 java-test-client:latest

About

This is an example of how to connect a Java Spring microservice to a python one through Thrift. Everything is Dockerized.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published