For a Maven project, add the following to your pom.xml
file:
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-sdk-parent</artifactId>
<version>1.0.0</version>
</dependency>
Clone this repository including the submodules:
git clone https://github.com/mosn/layotto.git
Build and run Layotto:
# make sure you replace this` ${projectpath}` with your own project path.
cd ${projectpath}/cmd/layotto
go build
./layotto start -c ../../configs/config_redis.json
Then head over to build the java-sdk Maven (Apache Maven version 3.x) project:
# make sure you replace this` ${projectpath}` with your own project path.
cd ${projectpath}/sdk/java-sdk
mvn clean install
Try the following examples to learn more about this SDK:
Compile before submit your pull request:
mvn clean compile
It will format your code automatically.
1. Download proto compiler protoc
my protoc version:
$ protoc --version
libprotoc 3.11.2
Make sure these option
fields have been configurated.
spec/proto/runtime/v1/appcallback.proto :
option java_outer_classname = "AppCallbackProto";
option java_package = "spec.proto.runtime.v1";
spec/proto/runtime/v1/runtime.proto :
option java_outer_classname = "RuntimeProto";
option java_package = "spec.proto.runtime.v1";
# make sure you replace this `${your PROJECT path}` with your own project path.
cd ${your PROJECT path}/spec/proto/runtime/v1
protoc -I=. --java_out=../../../../sdk/java-sdk/sdk/src/main/java/ runtime.proto
protoc -I=. --java_out=../../../../sdk/java-sdk/sdk/src/main/java/ appcallback.proto