Skip to content

reactivegroup/java-sdk-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文

How to use java sdk

1. import sdk

For a Maven project, add the following to your pom.xml file:

<project>
  ...
  <dependencies>
    ...
    <dependency>
        <groupId>io.mosn.layotto</groupId>
        <artifactId>runtime-sdk-parent</artifactId>
        <version>1.0.0</version>
    </dependency>
    ...
  </dependencies>
  ...
</project>

2. Run the examples

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:

java sdk developer guide

How to format java sdk code

Compile before submit your pull request:

mvn clean compile

It will format your code automatically.

How to generate a Java PROTO file

1. Download proto compiler protoc

my protoc version:

$ protoc --version
libprotoc 3.11.2

2. Check option fields in these proto files

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";

3. Compile them into corresponding JAVA files

# 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

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%