Skip to content

Commit

Permalink
feat: Add: 1.gRPC-in-action module.
Browse files Browse the repository at this point in the history
Signed-off-by: photowey <[email protected]>
  • Loading branch information
photowey committed Sep 17, 2024
1 parent e96ad93 commit 50d7a94
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 2 deletions.
3 changes: 1 addition & 2 deletions graphql-in-action/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<artifactId>graphql-in-action</artifactId>

<properties>
<spring-boot-starter-graphql.version>2.7.0</spring-boot-starter-graphql.version>
</properties>

<dependencies>
Expand All @@ -38,7 +39,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-graphql</artifactId>
<version>2.7.0</version>
</dependency>

<dependency>
Expand All @@ -56,7 +56,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
6 changes: 6 additions & 0 deletions grpc-in-action/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `gRPC-in-action`

## `HTTP 2.x`
- `Stream`
- `Message`
- `Frame`
47 changes: 47 additions & 0 deletions grpc-in-action/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.photowey</groupId>
<artifactId>the-way-to-java</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>grpc-in-action</artifactId>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>com.photowey</groupId>
<artifactId>print-in-action</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
38 changes: 38 additions & 0 deletions grpc-in-action/src/main/java/com/photowey/grpc/in/action/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright © 2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.photowey.grpc.in.action;

import com.photowey.print.in.action.printer.AppPrinter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
* {@code App}
*
* @author photowey
* @date 2024/09/17
* @since 1.0.0
*/
@SpringBootApplication
public class App {

public static void main(String[] args) {
ConfigurableApplicationContext applicationContext = SpringApplication.run(App.class, args);
AppPrinter.print(applicationContext, false);
}

}
23 changes: 23 additions & 0 deletions grpc-in-action/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
management:
endpoint:
shutdown:
enabled: true
health:
show-details: ALWAYS
endpoints:
web:
exposure:
# autoconfig & trace No mapping
# include: [health,info,beans,env,configprops,mappings,metrics]
include: "*"

# custom the /actuator/info endpoint
info:
app:
name: @project.artifactId@
encoding: @project.build.sourceEncoding@
java:
source: @java.version@
target: @java.version@
evn:
active: ${spring.profiles.active}
12 changes: 12 additions & 0 deletions grpc-in-action/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server:
port: 9527

spring:
application:
name: "grpc-in-action"
profiles:
active: dev

logging:
pattern:
console: '%red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %red([${spring.application.name}]) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger) - %cyan(%msg%n)'
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright © 2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.photowey.grpc.in.action;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

/**
* {@code AppTests}
*
* @author photowey
* @date 2024/09/17
* @since 1.0.0
*/
@SpringBootTest
class AppTests {

@Test
void contextLoads() {}

}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<!-- <module>spring-modulith-in-action</module> -->
<module>object-pool-in-action</module>
<module>dameng-in-action</module>
<module>grpc-in-action</module>
</modules>

<dependencyManagement>
Expand Down

0 comments on commit 50d7a94

Please sign in to comment.