Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patterns
Client-Side Service Discovery
Server-Side Service Discovery
Vert.x Service Discovery
Managing Failures Pattern
Timeout and Retry Pattern
Circuit Breakers
Health Checks and Failovers
Inversion of control using dependency injection in Web APIs using Unity Conta...Akhil Mittal
My article will explain how we can make our Web API service architecture loosely coupled and more flexible. We already learnt that how we can create a RESTful service using Asp.net Web API and Entity framework in my last article. If you remember we ended up in a solution with a design flaw, we’ll try to overcome that flaw by resolving the dependencies of dependent components. For those who have not followed my previous article, they can learn by having the sample project attached as a test application from my first article.
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patterns
Client-Side Service Discovery
Server-Side Service Discovery
Vert.x Service Discovery
Managing Failures Pattern
Timeout and Retry Pattern
Circuit Breakers
Health Checks and Failovers
Inversion of control using dependency injection in Web APIs using Unity Conta...Akhil Mittal
My article will explain how we can make our Web API service architecture loosely coupled and more flexible. We already learnt that how we can create a RESTful service using Asp.net Web API and Entity framework in my last article. If you remember we ended up in a solution with a design flaw, we’ll try to overcome that flaw by resolving the dependencies of dependent components. For those who have not followed my previous article, they can learn by having the sample project attached as a test application from my first article.
Mvc interview questions – deep dive jinal desaijinaldesailive
Can you describe ASP.NET MVC Request Life Cycle? 1. Receive request, look up Route object in RouteTable collection and create RouteData object. 2. Create RequestContext instance. 3. Create MvcHandler and pass RequestContext to handler. 4. Identify IControllerFactory from RequestContext. 5. Create instance of class that implements ControllerBase. 6. Call MyController.Execute method. 7. The ControllerActionInvoker determines which action to invoke on the controller and executes the action on the controller, which results in calling the model and returning a view.
Mastering Kubernetes - Basics and Advanced Concepts using Example Projectwajrcs
Kubernetes is one of the most important pillars of modern IT environments. However, working with Kubernetes continues to present companies with challenges - not least due to a rapidly growing ecosystem and complex application scenarios. With the full-day online conference Mastering Kubernetes, you will learn about the latest trends in container orchestration and how to use Kubernetes in practice. You will master the most important tools and techniques of the cloud-native world around Kubernetes!
1. Basic Understanding
2. Installation
3. Basic components
4. Advanced components
5. Example project
#Kubernetes #CloudComputing #Training #CICD #Docker #Networking
Google cloud certified professional cloud developer practice dumps 2020SkillCertProExams
Google Cloud Certified - Professional Cloud Developer Exam Tests Questions PDF 2020
Full Practice Tests: https://skillcertpro.com/yourls/pcd
Unlike others, We offer details explanation to each and every questions that will help you to understand the question.
Practice Questions are taken from previous real time tests and are prepared by Industry Experts at Skillcertpro.
Our study material can be accessed online and 100% accessible to mobile devices.
100% money back guarantee (Unconditional, we assure that you will be satisfied with our services and pass the exam.
Do leave us a question we will happy to answer your queries.
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataWaheed Nazir
Kotlin MVVM Architecture:
A sample app that display list of Google news. The purpose of this project to illustrate the usage of MVVM architecture design pattern that follow the best practices of Object Oriented Design Patterns using the following technology stack.
Architecture Design Pattern
MVVM
Dagger2 (Dependency Injection)
Live Data, MediatorLiveData
Room Database
Retrofit
Unit Testing (Espresso), Mockito (Coming soon)
Repository Pattern
AndroidX
Glide
NetworkBoundResource, NetworkAndDBBoundResource
Google News API
JetPack Libraries
The mainstreaming of containerization and microservices is raising a critical question by both developers and operators: how do we debug all this?
Debugging microservices applications is a difficult task. The state of the application is spread across multiple microservices, and it is hard to get a holistic view of the state of the application. Currently debugging of microservices is assisted by openTracing, which helps in tracing of a transaction or workflow for post-mortem analysis, and linkerd and itsio which monitor the network to identify latency problems. These tools however, do not allow to monitor and interfere with the application during run time.
In this talk, we will describe and demonstrate common debugging techniques and we will introduce Squash, a new tool and methodology.
AWS Security Specialty (SCS-C02) Exam | Study Tips & TricksAdinaCoyle
Click Here---> https://bit.ly/3DFASrH <---Get complete detail on SCS-C02 exam guide to crack Security Specialty. You can collect all information on SCS-C02 tutorial, practice test, books, study material, exam questions, and syllabus. Firm your knowledge on Security Specialty and get ready to crack SCS-C02 certification. Explore all information on SCS-C02 exam with number of questions, passing percentage and time duration to complete test.
Node.js and microservices go hand in hand. This comes mainly from the design of Node.js. It is a specialised small platform with an enormous package environment. The NPM ecosystem provides a lot of packages you can use to build your microservice. The two most popular frameworks for this job are Express and Seneca. In this talk I will show you how you can communicate synchronously and asynchronously with your microservices and how easy it is to put your Node.js application into a docker container.
Rehosting apps between k8s clusters and automating deployment using craneKonveyor Community
Watch the presentation: https://youtu.be/kp5vFIg0BhQ
With Crane 2.0, application owners can migrate Kubernetes workloads and their state between clusters of different Kubernetes distributions, remove environment-specific configuration, and automate application deployments along the way.
The community has distilled several years of experience performing large-scale production Kubernetes migrations into this tool. It’s designed to drive a migration via a pipeline of non-destructive tasks that dump their results to disk so the operation can be easily audited and versioned without impacting live workloads. The tasks can be run repeatedly and will output consistent results given the same inputs without side-effects on the system at large.
These projects can be large, complex, error-prone, and usually must be performed under a limited window of time. Because of that challenge, it's paramount that a migration tool be designed with transparency and ease-of-diagnostics in mind.
Presenters: Marco Berube and Erik Nelson
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGEEditor IJCTER
In without internet connection. this paper we have implemented private cloud data
storage server in Microsoft windows server 2K12operating system which provides software as a
services with mailing system for private cloud consumers & clients, through private cloud server
services clients can access web services, centralized data storage services , software as services and can also send and receive mails in entire network without internet connectivity. This paper is the implementation of cloud software as service, centralized remote accessibility and private mails system.
Microservices Pattern Language
Microservices Software Architecture Governance, Best Practices and Design Pattern
Decomposition Patterns
Decompose by Business Capability
Decompose by Subdomain
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK
Oracle JDK SE Public Updates
Oracle JDK SE Support Roadmap (LTS options)
Oracle JDK licenses
Oracle JDK vs Oracle OpenJDK
Java SE Release Roadmap
The OpenJDK build is free to use within a Red Hat Enterprise Linux (RHEL)
The Red Hat OpenJDK Features
More Related Content
Similar to Chapter 04: Eclipse Vert.x - Message Based Microservices
Mvc interview questions – deep dive jinal desaijinaldesailive
Can you describe ASP.NET MVC Request Life Cycle? 1. Receive request, look up Route object in RouteTable collection and create RouteData object. 2. Create RequestContext instance. 3. Create MvcHandler and pass RequestContext to handler. 4. Identify IControllerFactory from RequestContext. 5. Create instance of class that implements ControllerBase. 6. Call MyController.Execute method. 7. The ControllerActionInvoker determines which action to invoke on the controller and executes the action on the controller, which results in calling the model and returning a view.
Mastering Kubernetes - Basics and Advanced Concepts using Example Projectwajrcs
Kubernetes is one of the most important pillars of modern IT environments. However, working with Kubernetes continues to present companies with challenges - not least due to a rapidly growing ecosystem and complex application scenarios. With the full-day online conference Mastering Kubernetes, you will learn about the latest trends in container orchestration and how to use Kubernetes in practice. You will master the most important tools and techniques of the cloud-native world around Kubernetes!
1. Basic Understanding
2. Installation
3. Basic components
4. Advanced components
5. Example project
#Kubernetes #CloudComputing #Training #CICD #Docker #Networking
Google cloud certified professional cloud developer practice dumps 2020SkillCertProExams
Google Cloud Certified - Professional Cloud Developer Exam Tests Questions PDF 2020
Full Practice Tests: https://skillcertpro.com/yourls/pcd
Unlike others, We offer details explanation to each and every questions that will help you to understand the question.
Practice Questions are taken from previous real time tests and are prepared by Industry Experts at Skillcertpro.
Our study material can be accessed online and 100% accessible to mobile devices.
100% money back guarantee (Unconditional, we assure that you will be satisfied with our services and pass the exam.
Do leave us a question we will happy to answer your queries.
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataWaheed Nazir
Kotlin MVVM Architecture:
A sample app that display list of Google news. The purpose of this project to illustrate the usage of MVVM architecture design pattern that follow the best practices of Object Oriented Design Patterns using the following technology stack.
Architecture Design Pattern
MVVM
Dagger2 (Dependency Injection)
Live Data, MediatorLiveData
Room Database
Retrofit
Unit Testing (Espresso), Mockito (Coming soon)
Repository Pattern
AndroidX
Glide
NetworkBoundResource, NetworkAndDBBoundResource
Google News API
JetPack Libraries
The mainstreaming of containerization and microservices is raising a critical question by both developers and operators: how do we debug all this?
Debugging microservices applications is a difficult task. The state of the application is spread across multiple microservices, and it is hard to get a holistic view of the state of the application. Currently debugging of microservices is assisted by openTracing, which helps in tracing of a transaction or workflow for post-mortem analysis, and linkerd and itsio which monitor the network to identify latency problems. These tools however, do not allow to monitor and interfere with the application during run time.
In this talk, we will describe and demonstrate common debugging techniques and we will introduce Squash, a new tool and methodology.
AWS Security Specialty (SCS-C02) Exam | Study Tips & TricksAdinaCoyle
Click Here---> https://bit.ly/3DFASrH <---Get complete detail on SCS-C02 exam guide to crack Security Specialty. You can collect all information on SCS-C02 tutorial, practice test, books, study material, exam questions, and syllabus. Firm your knowledge on Security Specialty and get ready to crack SCS-C02 certification. Explore all information on SCS-C02 exam with number of questions, passing percentage and time duration to complete test.
Node.js and microservices go hand in hand. This comes mainly from the design of Node.js. It is a specialised small platform with an enormous package environment. The NPM ecosystem provides a lot of packages you can use to build your microservice. The two most popular frameworks for this job are Express and Seneca. In this talk I will show you how you can communicate synchronously and asynchronously with your microservices and how easy it is to put your Node.js application into a docker container.
Rehosting apps between k8s clusters and automating deployment using craneKonveyor Community
Watch the presentation: https://youtu.be/kp5vFIg0BhQ
With Crane 2.0, application owners can migrate Kubernetes workloads and their state between clusters of different Kubernetes distributions, remove environment-specific configuration, and automate application deployments along the way.
The community has distilled several years of experience performing large-scale production Kubernetes migrations into this tool. It’s designed to drive a migration via a pipeline of non-destructive tasks that dump their results to disk so the operation can be easily audited and versioned without impacting live workloads. The tasks can be run repeatedly and will output consistent results given the same inputs without side-effects on the system at large.
These projects can be large, complex, error-prone, and usually must be performed under a limited window of time. Because of that challenge, it's paramount that a migration tool be designed with transparency and ease-of-diagnostics in mind.
Presenters: Marco Berube and Erik Nelson
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGEEditor IJCTER
In without internet connection. this paper we have implemented private cloud data
storage server in Microsoft windows server 2K12operating system which provides software as a
services with mailing system for private cloud consumers & clients, through private cloud server
services clients can access web services, centralized data storage services , software as services and can also send and receive mails in entire network without internet connectivity. This paper is the implementation of cloud software as service, centralized remote accessibility and private mails system.
Similar to Chapter 04: Eclipse Vert.x - Message Based Microservices (20)
Microservices Pattern Language
Microservices Software Architecture Governance, Best Practices and Design Pattern
Decomposition Patterns
Decompose by Business Capability
Decompose by Subdomain
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK
Oracle JDK SE Public Updates
Oracle JDK SE Support Roadmap (LTS options)
Oracle JDK licenses
Oracle JDK vs Oracle OpenJDK
Java SE Release Roadmap
The OpenJDK build is free to use within a Red Hat Enterprise Linux (RHEL)
The Red Hat OpenJDK Features
Microservices Pattern Language
Microservices Software Architecture Governance, Best Practices and Design Pattern
Decomposition Patterns
Decompose by Business Capability
Decompose by Subdomain
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK
Oracle JDK SE Public Updates
Oracle JDK SE Support Roadmap (LTS options)
Oracle JDK licenses
Oracle JDK vs Oracle OpenJDK
Java SE Release Roadmap
The OpenJDK build is free to use within a Red Hat Enterprise Linux (RHEL)
The Red Hat OpenJDK Features
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
2. 00. HTTP Main Issues
a. Reactive Microservices must be:
• Autonomous
• Asynchronous
• Resilient
• Elastic
b. HTTP based microservices as demonstrated on chapter 03 is not
Reactive Microservices, because it does not provide the resilience and
elasticity.
c. It does not provide the resilience, because if the first microservice
(HttpMicro01 class) fails, we won’t be able to recover by calling
another one.
d. It does not provide the elasticity, if we are under load, creating a new
instance of the HttpMicro01 won’t help us, because HttpMicro02 is
configured to target the HttpMicro01 microservice explicitly.
e. HTTP based microservices can be Reactive Microservices if we
provide some infrastructure to route virtual URLs to a set of service
and a load-balancing strategy to provide elasticity and
health-check support to improve resilience.
3. 00. Message Based MSA
a. The Vert.x Event Bus is messaging backbone for creating Message
Based Microservices Architecture (MSA) that allowing the different
components of an application to interact using messages.
b. Messages are sent to addresses and have a set of headers and a body.
An address is an opaque string representing a destination. Message
consumers register themselves to addresses to receive the messages.
c. The Vert.x Event Bus is also clustered, meaning it can dispatch
messages over the network between distributed senders and
consumers. nodes are connected to enable shared data structure, hard-
stop failure detection, and load-balancing group communication.
d. The Vert.x Event Bus provides three types of delivery semantics:
1. The send method: allows a component to send a message to an
address. If more than one consumer is registered on this address,
Vert.x applies a round-robin strategy to select a consumer.
2. The publish method to deliver the message to all consumers
registered on the address.
3. The send method with a reply handler. This request/
response mechanism allows implementing message-based
asynchronous.
4. 00. Sequence Diagram
We will create two verticle classes with following
sequence diagram to demonstrate Message
based Microservices
MsgMicro02 MsgMicro01
HTTP Request
Address: “AdrMsg”, Message:”Firmansyah”
Reply: “hello Firmansyah”
Reply: “hello Indonesia”
HTTP Response
Address: “AdrMsg”, Message:”Indonesia”
5. 01. Create MsgMicro01 Class
a. Create a directory called “chapter04”
b. Generate the project structure using maven
inside chapter04 folder:
mvn io.fabric8:vertx-maven-plugin:1.0.5:setup
-DprojectGroupId=io.vertx.chapter04
-DprojectArtifactId=msg-micro01-vertx-app
-Dverticle=io.vertx.chapter04.MsgMicro01
-Ddependencies=infinispan
This command generates:
1. The Maven project structure,
2. Configures the vertx-maven-plugin, and
3. Creates a verticle class (io.vertx.chapter04.MsgMicro01),
4. Adds the Infinispan dependency, an in-memory data grid that will
be used to manage the cluster. Once generated, we may
need to configure Infinispan to build the cluster. The
default configuration uses multicast to discover the nodes.
6. 01. Create MsgMicro01 Class
c. Modify io.vertx.chapter04.MsgMicro01 Class
1. Update start() method :
@Override
public void start() {
// Receive message from the address 'AdrMsg'
vertx.eventBus().<String>consumer("AdrMsg", message -> {
JsonObject json = new JsonObject()
.put("served-by", this.toString());
// Check whether we have received a payload in the
// incoming message
if (message.body().isEmpty()) {
message.reply(json.put("message", "hello"));
} else {
message.reply(json.put("message",
"hello " + message.body()));
}
});
}
7. 01. Create MsgMicro01 Class
Notes:
• This code retrieves the eventBus from the vertx object and
registers a consumer on the address 'AdrMsg'. When a
message is received, it replies to it. Depending on whether or not
the incoming message has an empty body, we compute a
different response. As in the example in the previous chapter, we
send a JSON object back.
• We added the served-by entry in the JSON for knowing from
which instance of MsgMicro01 class will reply the message if we
clustered MsgMicro01 class.
d. Run the MsgMicro01 Class:
mvn compile vertx:run
-Dvertx.runArgs="-cluster -Djava.net.preferIPv4Stack=true"
The -cluster tells Vert.x to start in cluster mode.
8. 02. Create MsgMicro02 Class
a. Create a directory called “consumer” inside
chapter04 folder
b. Generate the new project structure using
maven inside consumer folder:
mvn io.fabric8:vertx-maven-plugin:1.0.5:setup
-DprojectGroupId=io.vertx.chapter04
-DprojectArtifactId=msg-micro02-vertx-app
-Dverticle= io.vertx.chapter04.MsgMicro02
-Ddependencies=infinispan,rx
9. 02. Create MsgMicro02 Class
c. Modify io.vertx.chapter04.MsgMicro02 inside
the start method with following logic:
1. Use the event bus to send a message to the 'AdrMsg‘
address and extract the body of the reply.
2. Use the zip operation to retrieve the two responses and build
the final result.
3. In the subscribe method, we print the final result to the console
or print the stack trace.
4. Add an HTTP server, when an HTTP request is received, we
send a message to the 'AdrMsg‘ twice and return the built
result as a HTTP response.
d. Run the MsgMicro02 Class:
mvn compile vertx:run
-Dvertx.runArgs="-cluster -Djava.net.preferIPv4Stack=true"
e. Browse URL http://localhost:8082/ and
look at the application output.
10. 03. Elasticity Demo
a. Use Ctrl + C to shut down all the application.
b. Package MsgMicro01 app as a fat jar file
mvn clean package
c. Open two different terminals in the chapter04
directory and issue the following command (in
each terminal):
java -jar target/msg-micro01-vertx-app-1.0-SNAPSHOT.jar --
cluster -Djava.net.preferIPv4Stack=true
d. Package MsgMicro02 app as a fat jar file
mvn clean package
e. Open a terminal in the consumer directory and
issue the following command
java -jar target/msg-micro02-vertx-app-1.0-SNAPSHOT.jar --
cluster -Djava.net.preferIPv4Stack=true
f. Browse URL http://localhost:8082/ and
look at the application output.
11. 03. Elasticity Demo Notes
a. Elasticity can be achieved more easily using message
microservices compare to HTTP microservices,
especially using Vertx Tool.
b. HTTP microservices is not enforcing elasticity,
because the HTTP microservice was targeting a
specific instance of the microservice using a hard-
coded URL (IP Address and Port).
c. The two instances of MsgMicro01 are used. The Vert.x
cluster connects two instances, and the event bus is
clustered. Thanks to the event bus round-robin, the
Vert.x event bus dispatches messages to the available
instances and thus balances the load among the
different instances listening to the same address.
d. So, by using the event bus, we have the elasticity
characteristic we need.
12. 04. Resilience Demo
a. Use Ctrl + C to shut down all the application.
b. Modify start() method on
io.vertx.chapter04.MsgMicro01 Class
c. Modify start() method on
io.vertx.chapter04.MsgMicro02 Class
d. Launch MsgMicro01 app in the chapter04 directory
using following command:
mvn compile vertx:run -Dvertx.runArgs="-cluster -
Djava.net.preferIPv4Stack=true"
e. Launch MsgMicro02 app in the consumer directory
using following command:
mvn compile vertx:run -Dvertx.runArgs="-cluster -
Djava.net.preferIPv4Stack=true"
13. 04. Resilience Demo Notes
a. Even though the system get failure or / and don't get
the response, we don’t crash, we don’t limit our
scalability, and we can still handle requests.
b. We implement retry to retrieve the value if it gets a
failure in the form of a timeout or an explicit failure.
c. We implement timeout to improve the user
experience, we should always reply in a timely fashion
to the user, even if we don’t receive the responses
from the service.
d. Now we can reload the page and will always get a
result, even if there are failures or timeouts.
Remember that the thread is not blocked while calling
the service, so we can always accept new requests
and respond to them in a timely fashion.
e. However, this timeout retry often causes more harm
than good, as we will see in the next chapter.
14. Thank You!
Any questions? You can find me at
firmansyah.profess@gmail.com
Credits
PPT: ALLPPT.com
Music: https://www.bensound.com