-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds remote-procedure-call via gRPC #3189
base: master
Are you sure you want to change the base?
Conversation
PR SummaryThis PR implements remote procedure calls using gRPC in Java. It introduces two microservices, Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM!
Review Summary
Commits Considered (1)
- 390358d: remote-procedure-call
Files Processed (30)
- pom.xml (1 hunk)
- remote-procedure-call/README.md (1 hunk)
- remote-procedure-call/cart-service/etc/cart-service.urm.png (0 hunks)
- remote-procedure-call/cart-service/etc/cart-service.urm.puml (1 hunk)
- remote-procedure-call/cart-service/pom.xml (1 hunk)
- remote-procedure-call/cart-service/src/main/java/com/iluwatar/rpc/cart/Main.java (1 hunk)
- remote-procedure-call/cart-service/src/main/java/com/iluwatar/rpc/cart/model/ProductInCart.java (1 hunk)
- remote-procedure-call/cart-service/src/main/java/com/iluwatar/rpc/cart/service/CartService.java (1 hunk)
- remote-procedure-call/cart-service/src/main/java/com/iluwatar/rpc/cart/service/CartServiceImpl.java (1 hunk)
- remote-procedure-call/cart-service/src/main/resources/logback.xml (1 hunk)
- remote-procedure-call/cart-service/src/test/java/com/iluwatar/rpc/cart/service/CartServiceImplIntegrationTest.java (1 hunk)
- remote-procedure-call/cart-service/src/test/java/com/iluwatar/rpc/cart/service/CartServiceImplTest.java (1 hunk)
- remote-procedure-call/cart-service/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker (1 hunk)
- remote-procedure-call/etc/remote-procedure-call.urm.puml (1 hunk)
- remote-procedure-call/pom.xml (1 hunk)
- remote-procedure-call/product-service/etc/product-service.urm.png (0 hunks)
- remote-procedure-call/product-service/etc/product-service.urm.puml (1 hunk)
- remote-procedure-call/product-service/pom.xml (1 hunk)
- remote-procedure-call/product-service/src/main/java/com/iluwatar/rpc/product/Main.java (1 hunk)
- remote-procedure-call/product-service/src/main/java/com/iluwatar/rpc/product/mocks/ProductMocks.java (1 hunk)
- remote-procedure-call/product-service/src/main/java/com/iluwatar/rpc/product/model/Product.java (1 hunk)
- remote-procedure-call/product-service/src/main/java/com/iluwatar/rpc/product/service/ProductService.java (1 hunk)
- remote-procedure-call/product-service/src/main/java/com/iluwatar/rpc/product/service/ProductServiceGrpcImpl.java (1 hunk)
- remote-procedure-call/product-service/src/main/java/com/iluwatar/rpc/product/service/ProductServiceImpl.java (1 hunk)
- remote-procedure-call/product-service/src/main/resources/logback.xml (1 hunk)
- remote-procedure-call/product-service/src/test/java/com/iluwatar/rpc/product/service/ProductServiceGrpcImplTest.java (1 hunk)
- remote-procedure-call/product-service/src/test/java/com/iluwatar/rpc/product/service/ProductServiceImplTest.java (1 hunk)
- remote-procedure-call/product-service/src/test/java/com/iluwatar/rpc/product/service/ProductServiceIntegrationTest.java (1 hunk)
- remote-procedure-call/product-service/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker (1 hunk)
- remote-procedure-call/proto/shopping.proto (1 hunk)
Actionable Comments (0)
Skipped Comments (0)
|
@@ -225,6 +225,7 @@ | |||
<module>money</module> | |||
<module>table-inheritance</module> | |||
<module>bloc</module> | |||
<module>remote-procedure-call</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested: microservices-rpc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for the folder name as well)
@@ -0,0 +1,147 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md
needs to follow the specified format. See https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute
/** | ||
* Main class for the cart service. | ||
* Initializes the shopping channel and the cart service. | ||
* | ||
* @author CoderSleek | ||
* @version 1.0 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, above the class, please explain the pattern briefly and describe how the example implements it
ManagedChannel productChannel = ManagedChannelBuilder | ||
.forAddress(HOST, SERVER_PORT) | ||
.usePlaintext() | ||
.enableRetry() | ||
.keepAliveTime(10, TimeUnit.SECONDS) | ||
.build(); | ||
|
||
ShoppingServiceBlockingStub blockingStub = ShoppingServiceGrpc.newBlockingStub(productChannel); | ||
log.info("cart-service started"); | ||
|
||
var cartService = new CartServiceImpl(blockingStub); | ||
cartService.getAllProducts(); | ||
|
||
var productInCart = cartService.getRandomProductFromCart(); | ||
productInCart.setQuantityToReduce(10); | ||
|
||
cartService.reduceCartQuantityFromProduct(productInCart); | ||
productChannel.shutdown(); | ||
log.info("cart-service execution successful, shutting down"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments. Remember, this is material for studying the design pattern.
Fixes #2680