-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from herts-stack/fix-codegen-bug
Fix message data
- Loading branch information
Showing
48 changed files
with
6,439 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
@HertsHttp | ||
public interface HttpService extends HertsService { | ||
String helloWorld(); | ||
TestModel getModel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
example/src/main/java/org/hertsstack/example/http/TestModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.hertsstack.example.http; | ||
|
||
import org.hertsstack.core.modelx.HertsMessage; | ||
|
||
public class TestModel extends HertsMessage { | ||
private String id; | ||
private String name; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
example/src/main/java/org/hertsstack/example/tlshttp/HttpService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.hertsstack.example.tlshttp; | ||
|
||
import org.hertsstack.core.annotation.HertsHttp; | ||
import org.hertsstack.core.service.HertsService; | ||
|
||
@HertsHttp | ||
public interface HttpService extends HertsService { | ||
String helloWorld(); | ||
} |
10 changes: 10 additions & 0 deletions
10
example/src/main/java/org/hertsstack/example/tlshttp/HttpServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.hertsstack.example.tlshttp; | ||
|
||
import org.hertsstack.core.service.HertsServiceHttp; | ||
|
||
public class HttpServiceImpl extends HertsServiceHttp<HttpService> implements HttpService { | ||
@Override | ||
public String helloWorld() { | ||
return "hello world"; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
example/src/main/java/org/hertsstack/example/tlshttp/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.hertsstack.example.tlshttp; | ||
|
||
import org.hertsstack.core.context.HertsMetricsSetting; | ||
import org.hertsstack.http.HertsHttpEngine; | ||
import org.hertsstack.http.HertsHttpServer; | ||
import org.hertsstack.httpclient.HertsHttpClient; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
startServer(); | ||
startClient(); | ||
try { | ||
Thread.sleep(1000000); | ||
} catch (InterruptedException e) { | ||
} | ||
System.exit(0); | ||
} | ||
|
||
private static void startServer() { | ||
HertsMetricsSetting metrics = HertsMetricsSetting.builder() | ||
.isRpsEnabled(true) | ||
.isLatencyEnabled(true) | ||
.isErrRateEnabled(true) | ||
.isServerResourceEnabled(true) | ||
.isJvmEnabled(true) | ||
.build(); | ||
|
||
HertsHttpEngine engine = HertsHttpServer.builder() | ||
.registerHertsHttpService(new HttpServiceImpl()) | ||
.setMetricsSetting(metrics) | ||
.setPort(443) | ||
.build(); | ||
|
||
Thread t = new Thread(engine::start); | ||
t.start(); | ||
} | ||
|
||
private static void startClient() { | ||
HertsHttpClient client = HertsHttpClient | ||
.builder("localhost") | ||
.registerHertsService(HttpService.class) | ||
.secure(false) | ||
.build(); | ||
|
||
var service = client.createHertsService(HttpService.class); | ||
var res = service.helloWorld(); | ||
System.out.println(res); | ||
} | ||
} |
Oops, something went wrong.