Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rajadilipkolli/poc

My POC's against various concepts
https://github.com/rajadilipkolli/poc

activemq flyway mongodb rabbitmq spring-boot-rest spring-data-mongodb spring-data-redis swagger-ui

Last synced: 17 days ago
JSON representation

My POC's against various concepts

Awesome Lists containing this project

README

        

= My POC image:https://github.com/rajadilipkolli/POC/workflows/Java%20CI/badge.svg?branch=master["Build Status",link="https://github.com/rajadilipkolli/POC/actions?query=workflow%3A%22Java+CI%22"] image:https://codecov.io/gh/rajadilipkolli/POC/branch/master/graph/badge.svg["Codecov",link="https://codecov.io/gh/rajadilipkolli/POC"] image:https://img.shields.io/:license-apache-blue.svg?style=flat-square["License",link="https://github.com/rajadilipkolli/POC/blob/master/LICENSE"]

image:https://gitpod.io/button/open-in-gitpod.svg["Open in Gitpod",link="https://gitpod.io/#https://github.com/rajadilipkolli/POC"]

== Introduction
This repo is for all POC which I does and learning's I learnt
Below are the projects that I have completed POC

- link:poc-mongodb-redis-cache/mongodb-redis-integration/ReadMe.adoc[mongodb-redis-integration] -> adding fault tolerant caching layer to MongoDB.
- link:poc-mongodb-redis-cache/reactive-mongodb-redis-integration/ReadMe.md[reactive-mongodb-redis-integration] -> adding fault tolerant reactive caching layer to reactive MongoDB.
- link:poc-rest-api//README.md[spring-boot-rest-webmvc] -> Enterprise application integrated with spring data, datasource-proxy, JPA, ActiveMQ(for demostration)

=== Filing Issues

If you encounter any bug, please file an issue https://github.com/rajadilipkolli/POC/issues/new[here].

To suggest a new feature or changes that could be made, file an issue the same way you would for a bug.

=== Pull Requests

Pull requests are welcome. To open your own pull request, click https://github.com/rajadilipkolli/POC/compare[here]. When creating a pull request, make sure you are pointing to the fork and branch that your changes were made in.

=== How to setup Project

This project is using lombok so you need to prepare your IDE as described http://www.vogella.com/tutorials/Lombok/article.html[here].
After Setup import project as a maven project.

=== Jacoco
**Code coverage** is a software metric used to measure how many lines of our code are executed during automated tests.
JaCoCo reports help you visually analyze code coverage by using diamonds with colors for branches and background colors for lines:

- **Red diamond** means that no branches have been exercised during the test phase.
- **Yellow diamond** shows that the code is partially covered – some branches have not been exercised.
- **Green diamond** means that all branches have been exercised during the test.
The same color code applies to the background color, but for lines coverage.

JaCoCo mainly provides three important metrics:

- **Lines coverage** reflects the amount of code that has been exercised based on the number of Java byte code instructions called by the tests.
- **Branches coverage** shows the percent of exercised branches in the code – typically related to if/else and switch statements.
- **Cyclomatic complexity** reflects the complexity of code by giving the number of paths needed to cover all the possible paths in a code through linear combination.
To take a trivial example, if there is no if or switch statements in the code, the cyclomatic complexity will be 1, as we only need one execution path to cover the entire code.

Generally the cyclomatic complexity reflects the number of test cases we need to implement in order to cover the entire code.

=== How to apply spring-formatter

To assign spring-formatter issue command after adding plugin to pom.xml

[indent=0]
----
mvnw io.spring.javaformat:spring-javaformat-maven-plugin:apply
----

=== How to release a multi module project to git

__Release using maven and git flow__

- git checkout -b release master(create branch release from master)
- mvn --batch-mode release:prepare release:perform -DscmCommentPrefix="bumping versions" -DreleaseVersion=0.0.1 -DdevelopmentVersion=0.0.2-SNAPSHOT(sets comments, release version and development version)
- git checkout master(get lastest master in local)
- git merge --no-ff -m "Release Merge release into master" release (merge master with release/0.0.1 branch) or use git merge branchname
- git branch -D release(delete branch release)
- git push --all && git push --tags(push master and tags to repository)
- mvn release:clean(deleted backupfiles from local env)

== Notes:

#In the context of imperative programming:#

1. List-based functional programming is eagerly evaluated.
2. Stream() introduced in Java 8 and is the seam showing we're not programming imperatively anymore. Is it required, though?
a. imperative - what and how
b. declarative - what and not how + higher order functions = FP. Code reads like the problem statement, through "internal iteration"/ "iteration on autopilot"
Mutability is OK, but shared mutability is not.
3. In OOP we encapsulate moving parts - in FP, we eliminate them.
4. Is stream API slow - you don't want a faster bicycle, but a rocket - EASIER TO PARALLELIZE
5. List is bucket, Stream is pipeline. You don't store water in a pipeline, you just move it through there.
6. Functional composition (builder pattern) is essential.
7. Lazy evaluation example - removing the terminal (collect) method - functions not being called anymore, as result not needed.
8. Many languages give programming pattern, such as Groovy, but laziness not there, as it depends on implementation.

#Limitations of streams:#

1. Single use only. Example where a stream is assigned to a variable, printed and then used with different filter condition. Result: IllegalStateException: stream has been operated on or closed.
a. Concept: streams like QTips - use once and throw away.
2. Not possible to fork in the middle. Only a single terminal operation.
3. How do you deal with exceptions: sorry :(. Exception handling is an imperative-style idea: call a function, which calls a function, etc. and destroys your callstack.
a. Scala has Mono monads and Either objects - provides safe handling, which is propagated and used in downstream stages. Lacks cohesion!
b. Still good luck - we want pure functions and exceptions normally come from impurity.

#Reactive systems:#

1. Came out of Microsoft research, but just a new name for old concept - system that reacts to stimuli
2. Four pillars of reactive programming:
a. Elasticity
b. Message-driven
c. Responsive
d. Resilience - circuit breakers built in, partial access to application
3. Close to the 80's concept of dataflow computing: d → f → d →f
a. Instructions ready to fire when the data is available
b. Serverless computing (AWS Lambda) == dataflow programming. At the minute computation is ready and prepared it can run on ANY server with predefined affinity
4. Reactive programming is FP++ - builds on lazy evaluation and functional composition
a. Example with Flowable and subscribe on it
5. Both Java Streams and Reactive ones push data, regular iterators pull. They are similar to Observable, you register to it and it pushes data to you.
6. Both can return 0, 1 or more data.
7. Java 8 Streams deal only with data. RS contain three channels (Data, Err, Complete). In RS error is just another form of data.
8. RS are asynchronous, so you are not locked into parallelism (sync).
9. RS can handle consumer back-pressure.
10. Multiple subscribers in RS, where single pipeline in Java Streams
11. Interface differences:
a. Reactive Stream:
- Publisher
- Subscriber
- Subscription - session between emitter and subscriber, can hold context
- Processor - publisher + subscriber
- Implementations: RxJava, Akka, Reactor (Spring 5), RSocket
b. Java reactive streams - same interface, since Java 9 - in the java.util.concurrent.Flow.* class

== Commands to ensure that dependencies are upgraded

- mvn versions:display-plugin-updates
- mvn versions:display-property-updates

== Topics to learn
Java Memory Model Very Important
- https://www.youtube.com/watch?v=ZBJ0u9MaKtM
- http://tutorials.jenkov.com/java-concurrency/java-memory-model.html
- https://walkingtree.tech/design-patterns-microservices/
- https://springframework.guru/gang-of-four-design-patterns/state-pattern/ (State Pattern)
- https://techburst.io/microservices-design-patterns-a9a03be3aa5e (Diagram of design pattern)
- https://github.com/AnghelLeonard/Hibernate-SpringBoot (Hibernate)
- https://www.youtube.com/channel/UCiz26UeGvcTy4_M3Zhgk7FQ (Defog Tech esp Threads)
- https://www.youtube.com/channel/UCZCFT11CWBi3MHNlGf019nw (Algorithms)
- https://dzone.com/articles/microservices-communication-zuul-api-gateway-1
- https://microservices.io/patterns/microservices.html
- https://microservices.io/patterns/data/api-composition.html
- https://www.tutorialspoint.com/spring_boot/spring_boot_eureka_server.htm
- https://dzone.com/articles/spring-boot-autoscaler
- https://www.elastic.co/what-is/elk-stack
- https://dzone.com/articles/libraries-for-microservices-development
- https://logz.io/blog/kibana-tutorial/
- https://dzone.com/articles/magic-of-kafka-with-spring-boot
- https://www.baeldung.com/spring-cloud-rest-client-with-netflix-ribbon
- https://jwt.io/introduction/
- https://www.springboottutorial.com/introduction-to-centralized-logging-with-microservices
- https://dzone.com/articles/microservices-architectures-centralized-configurat
- https://developers.redhat.com/blog/2019/03/12/distributed-microservices-architecture-enterprise-integration-istio-and-managed-api-gateways/
- https://docs.vmware.com/en/VMware-vSphere/6.7/Cloud-Native-Storage/GUID-CF1D7196-E49C-4430-8C50-F8E35CAAE060.html
- https://pivotal.io/cloud-native
- https://www.loomsystems.com/blog/single-post/2017/01/30/a-comparison-of-fluentd-vs-logstash-log-collector
- https://logz.io/blog/fluentd-logstash/
- https://www.callicoder.com/java-8-completablefuture-tutorial/
- https://codete.com/blog/5-common-spring-transactional-pitfalls/