MySQL
What is INDEX?
What INDEX do you use much, How will you create INDEX?\
What is Pessimistic and Optimistic locking?
Java
What is StringBuffer and StrinBuilder?\
MySQL
What is INDEX?
What INDEX do you use much, How will you create INDEX?\
What is Pessimistic and Optimistic locking?
Java
What is StringBuffer and StrinBuilder?\
Choreography Or Orchestration
Steps (Microservices and Persistent Layer)
Events
States
Bounded Contexts
Actors
Compensating Transactions
Eventual Completion (Happy Path/ Unhappy Path)
Retry able Transaction - Transactions followed by Pivot transaction. If the Seat allocation done, next ones will be processed.
List of Idempotent transactions - Identify
We have been using the below packages and the classes for Data Time for long time. But after Java 8 release there is big relief for developers and they can do date, time manipulations with lesser code.
We will compare them.
Without the Kubernetes, how can we manage and orchestrate cluster of containers in AWS.
Do you want to deploy your applications (Java, .NET, Node JS) in AWS cloud easily? Then the best way is to go for Beanstalk.
Just upload your application like JAR file if Java application, and create application. Beanstalk automatically provision all required resources and deploy them, and provides the URI to access the application. It is very fast deployment without struggling defining your EC2, Scaling, Load balancing configuration and you can have full control on created resources like EC2 instances etc.,
If you want to terminate the application, please choose and terminate. It will terminate only the EC2 instance. But to remove your application from S3, please click application and click "Delete" button.
Here we will see.
allows teams to easily version, audit, and collaborate on infrastructure changes. It also securely stores variables, including API tokens and access keys, and provides a safe, stable environment for long-running Terraform processes.
For more hands-on experience with the Terraform configuration language, resource provisioning, or importing existing infrastructure, review the tutorials below.
Configuration Language - Get more familiar with variables, outputs, dependencies, meta-arguments, and other language features to write more sophisticated Terraform configurations.
Modules - Organize and re-use Terraform configuration with modules.
Provision - Use Packer or Cloud-init to automatically provision SSH keys and a web server onto a Linux VM created by Terraform in AWS.
Import - Import existing infrastructure into Terraform.
Do we need Repository for artifacts?
Do we need repository only for dependencies and not for applications?
What is Infra as Code and how terraform helps?
DevOps :
Culture :
Development, Infra, IT, Business and Testing team - will work as single unit
Best Practices
Developers involve in IT Operations
IT Operations involve in Development
Version Control for Code, Infra, Repo
Adapt new changes quickly to Code, IT, Process, Infra
Everything Automated - Code, CI, CD, Testing, Reports
Containerized Tools and Environment - DEV-PROD parity
Tools
Source control - Code Repo, DockerHub, Access provisioning
CI/CD - Jenkins Docker Images, Security, Access provisioning
Testing
Code Coverage Tools
Configuration Management and Tools
Binary Management/ Artifactory
Monitoring
Security
Collaboration
Here we will
Here in above file we use the image adoptopenjdk/openjdk11 We copy the built jar file as beerOrderService.jar We expose the post it need to be executed. The execution command to run application once container started |
The battle boils down to the team or the project you work on. While Jenkins is more flexible to create and deploy complex workflows, Azure DevOps is faster to adapt. In most cases, organizations use both the tools and in such cases, Azure Pipelines supports integration with Jenkins.
Here we will create CI and CD Pipelines to build and deploy application using Jenkins pipelines.
We can create in two was
1. Pipeline Script
2. Pipeline Script from SCM
https://plugins.gradle.org/search?term=com.palantir.docker
https://palantir.github.io/
https://tomgregory.com/bmuschko-docker-gradle-plugin-review/
https://tomgregory.com/automating-docker-builds-with-gradle/
@ExceptionHandler can be used at the local level or at the global level. Local level would mean using this annotation within the controller itself to handle the exceptions within that controller only. All error thrown by that controller would be caught by that @ExceptionHandler. But this would mean that if there is a similar exception in a different controller you would have to rewrite the corresponding code again in that controller again locally.
In order to prevent repeating this style of exception handling per controller we can write the @ExceptionHanlder at the global level with the help of another annotation called @ControllerAdvice.
@ControllerAdvice is not specific to the exception handling , its also used for handling property, validation or formatter bindings at the global level. @ControllerAdvice in the context of exception handling is just another way of doing exception handling at a global level using @Exceptionhandler annotation.
Now coming to the HandlerExceptionResolver - this is an interface at a more lower level. Spring provides 2 implementations of this:
Example : So when you want to handle exceptions and choose an exception handling strategy you will need to think of choosing between using a local or global exception handling via the annotations. How you need to provide the HTTP status codes, how to wrap it in the @Response entity etc, how you want to redirect to handler pages , carry the data via flash attributes or get params etc etc. Or maybe skip the annotations and use the SimpleMappingExceptionResolver and start mapping the specific exceptions to the error handler page urls
Here we are not be considering the lower level underlying HandlerExceptionResolver at this stage since we are dealing with its implementation at a higher level and building the strategy based on these options.
With the above context to answer your query - @ControllerAdvice was not introduced for exception handling, it's a mechanism you can leverage to handle exceptions globally using the @ExceptionHandler. HandlerExceptionResolver is an interface whose implementation helps support the @ResponseStatus and the @Exceptionhandler annotations. Unless you want to handle the exceptions related to the MVC system because the Spring framework does not provide any proper exception handling. So if you need to hand;e issues related to incorrect @Requestmapping etc which would not be caught by a controller as it would not even reach it in the 1st place then an implementation of the HandlerExceptionResolver would be useful
Git Repo:
https://github.com/balajimathu/beer-order-service
Create Below APIs using Spring Webflux.
1. Order Service - will invoke below APIs use spring-boot-starter-validation
2. Inventory Service - search and confirm availability, if not available Order Service will return message.
3. Price Service - Search and get latest price, Store actual prices in DB, implement Spring Data to apply seasonal offers, configurable
4. Shipment Service - On successful creation Send mail. @Email - -Validation
5. Payment Service - Insert data in DB and return an transaction id.
6. Implement @ControllerAdvice - Reactive
Implement CommandLineRunner to check the availability of DependencyAPIs on startup..
Database:
Postgres
Platform:
Create Docker Images for REST APIs and Postgres DB
Run Jenkins on AWS EC2
CI and CD Pipelines
Deploy all these in Containers, separately,
Authentication - NO Auth as of now.
Lets implement the other requirement – to apply seasonal global discounts to all products when we select records from DB. Here we do not want to touch the database. We still want to keep the original price as it is. We just want to update the price once it is retrieved from DB.
AfterConvertCallback hook would be a good choice here.
\BeforeConvertCallback. In this case our implementation should implement Ordered as well as shown here to return the order in which it should be executed.
Sometimes the actual table might have more columns and entity object might not contain all the fields. For ex: fields like created_by, created_date etc. But we might want to update these fields. In this case, BeforeConvertCallback will not help much! But we could achieve with BeforeSaveCallback.