The following frameworks are available to implement the Saga orchestration pattern:
Camunda is a Java-based framework that supports the Business Process Model and Notation (BPMN) standard for workflow and process automation.
Apache Camel provides implementation for the Saga EIP (Enterprise Integration Pattern), a way to define a series of related actions in a Camel route that should be either completed successfully (all of them) or not-executed or compensated.
IBM App Connect allows you to draw out a flow using various built-in adapters and configure its properties appropriately to create a Saga flow
Apache oozie
API gateway: https://learn.microsoft.com/en-us/azure/architecture/microservices/design/gateway
Some of these terms have different meanings depending on whether you’re talking about relational versus NoSQL databases.
Replication:
In always-available relational environments, you want some way to synchronize your database instances so they’re as close to up-to-date to each other as possible. This synchronization scheme is called Replication. You’ll want this for “hot failover” if your primary instance goes down, and you may have a stack of hosts that are all replicating off of a primary. You may also have “write masters” and “read slaves” that are used in very performance-sensitive environments.
Different relational DB worlds do replication differently; some directly send queries to replicas using network connections, others stream queries (or rows to be updated) as files that are “played”, etc. One concern in any replication stack is “replica lag”, which is something DBAs have to keep track of.
NoSQL clusters also have a notion of replication which is often similar in design to the idea of RAIDed disk arrays in that the same data may be “striped” to multiple nodes.
Partitioning:
Partitioning is a term that has somewhat different meanings in relational versus NoSQL worlds. In relational worlds, partitioning is a storage-level concept that applies at the table level; if one has a very large table, it can be “partitioned” into smaller storage units using various types of partitioning rules, based on a user-specified partition key. Here’s a good discussion of this type of partitioning in MySQL: What is MySQL Partitioning?
In most NoSQL worlds, partitioning describes the rules for allocating different pieces of data to different nodes, as in the vast majority of NoSQL DB’s, you don’t have all your data on every node. There is a notion of a partition key, which must be chosen with care, and is a very important part of your overall database design, and the partition key and your partitioning rules determine what nodes get a specific piece of data, and how requests for that data are routed if you’re asking for it from a node that doesn’t have that data.
The “P” in the CAP theorem is this sense of partitioning…
The analog of the NoSQL sense of partitioning in distributed relational worlds is Sharding.
Sharding:
As mentioned above, Sharding is to distributed relational database environments as Partitioning is to NoSQL environments. The main difference is that most relational databases require you to have app-visible policies for sharding, and care must be taken with the shard key so you can make sure that joins can be done within the scope of your overall shard key (without needing to attempt extremely slow cross-database joins). So, picking the right shard key is pretty fundamental to the success of a distributed relational DB world.
“Resharding” and shard-splitting are tasks that DBAs and app developers may have to deal with occasionally.
Clustering:
In relational databases, clustering unfortunately has many vendor-specific meanings. Oracle has something called a “table cluster”, which has some storage optimizations, etc. PostgreSQL has a notion of CLUSTER where individual tables can be physically rebuilt using a specific cluster key for performance reasons.
That said, the most widely-used notion of “clustering” in relational databases is probably referring to the notion of a clustered index. This is also sometimes called a primary index, in that storage engines that support clustered index use it to organize the base table data around the cluster key - which is almost always the primary key or a part of a composite PK - to maximize performance.
Replication - Copying an entire table or database onto multiple servers. Used for improving speed of access to reference records such as master data.
Partitioning - Splitting up a large monolithic database into multiple smaller databases based on data cohesion. Example - splitting a large ERP database into modular databases like accounts database, sales database, materials database etc.
Clustering - Using multiple application servers to access the same database. Used for computation intensive, parallelized, analytical applications that work on non volatile data.
Sharding - Splitting up a large table of data horizontally i.e. row-wise. A table containing 100s of millions of rows may be split into multiple tables containing 1 million rows each. Each of the tables resulting from the split will be placed into a separate database/server. Sharding is done to spread load and improve access speed. Facebook/twitter tables fit into this category.
Sort hashmap with custom key object. hashmap has customer object as key then immutable object. Because of this reason string is preferred as key
Sort hashmap by values
synchronised hashmap vs concurrent hashmap
LinkedHashmap maintiains order
TreeMap maintains sorting order
Also, see internal working of following
HashMap [https://medium.com/javarevisited/internal-working-of-hashmap-in-java-97aeac3c7beb, https://www.codingninjas.com/codestudio/library/implementation-of-hashmap ] it adds at first position when duplicate index, HashTable, Concurrent HashMap [array of linkedlist]
LinkedHashMap [https://anmolsehgal.medium.com/java-linkedhashmap-internal-implementation-44e2e2893036 ] work as double linkedlist [array of doublinkedlist]
TreeMap: internally uses RB Tree [https://medium.com/xebia-engineering/treemap-internals-199e0e0050b5]
TreeSet: The data structure for the TreeSet is TreeMap; it contains SortedSet & NavigableSet interface to keep the elements sorted in ascending order and navigated through the tree
[The join() method of a Thread instance can beused to “join” the start of a thread’s execution to the end of another thread’s executionso that a thread will not start running until another thread has ended. If join() is called on a Thread instance, the currently running thread will block until the Thread instance has finished executing].
public class Bird{
public void fly(){}
}
public class Duck extends Bird{}
The duck can fly because it is a bird, but what about this:
public class Ostrich extends Bird{}
Ostrich is a bird, but it can't fly, Ostrich class is a subtype of class Bird, but it shouldn't be able to use the fly method, that means we are breaking the LSP principle.
Good example
public class Bird{}
public class FlyingBirds extends Bird{
public void fly(){}
}
public class Duck extends FlyingBirds{}
public class Ostrich extends Bird{}
Design Pattern in Java
Creational Design pattern: are concerned with the way of creating objects. Singleton, Builder, Factory pattern, Abstract Fcatory https://www.baeldung.com/creational-design-patterns
Structural Design pattern : These patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient. Adopter, Decorator, Facade, Composite, Bridge https://www.baeldung.com/java-core-structural-patterns
Behavioural Design pattern : are concerned with the interaction and responsibility of objects. Observer, Iterator, ChainOfResponsibility, Strategy,Command https://www.baeldung.com/java-behavioral-patterns-jdk
1. Spring IOC container(acheived by Dependency Injection)
2. Types of IOC Container [BeanFactory and ApplicationContext]
3. bean vs Component
4. Dependency Injection: Dependency injection enables you to turn regular Java classes into managed objects and to inject them into any other managed object. Using dependency injection, your code can declare dependencies on any managed object.A dependency injection is a strategy that is used to separate the creation of dependency objects from the class that needs them.
5. Types of Dependency Injection[2 types: constructor and method or field based DI]
6. Bean scopes [5 types: singleton, prototype, session,request, global session]
7. Dispatcher servlet and flow
8. Spring modules worked on?
9. Spring JPA, SpringAOP, Spring Batch,Spring Security,Springn cloud,Springreactive
10. Spring JDBC API
11. Spring reactive
12. @Controller, @RestController, @Service,@Repository(difference why we use difffernt annotation )
For security we use Spring Security framework (and also we must know JAAS also exists). There are many other as well.
1. Difference between authentication and authorisation
2. OAuth : standard authentication and authorisation framework or protocol.
3. OAuth1 vs OAuth 2
[OAuth 2.0 is the industry-standard protocol for authorization. OAuth 2.0 focuses on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices.]
7. JWT Structure [https://jwt.io/introduction]. Explain how it is implemented in java
8. JWT vs Oauth 2.0 Access token. [JWT defines a token format while OAuth deals in defining authorization protocols. JWT is simple and easy to learn from the initial stage while OAuth is complex. OAuth uses both client-side and server-side storage while JWT must use only client-side storage. JWT has limited scope and use cases.]
9. OpenId Connect [There is one more way to combine JWT and OAUth2. You need to guide OAuth2 to issue two tokens. The first token should be access_token and the second token should be a JWT token featuring additional identity details. While you plan to adopt this way to combine JWT and OAuth2, you need to make sure that you’re using OpenID Connect.]
Merge Sort: https://www.geeksforgeeks.org/merge-sort/ [if confusion in value of k then use another link where it refers to p, https://www.programiz.com/java-programming/examples/merge-sort]
JavaScript is a dynamically typed language. In a dynamically typed language, the type of a variable is checked during run-time in contrast to a statically typed language, where the type of a variable is checked during compile-time.
In JavaScript, primitive data types are passed by value and non-primitive data types are passed by reference.
Functions that operate on other functions, either by taking them as arguments or by returning them, are called higher-order functions.
Memoization is a form of caching where the return value of a function is cached based on its parameters. If the parameter of that function is not changed, the cached version of the function is returned.