The key components in Reactive Streaming or Reactive System are the resource, publisher, subscriber.
One real-life example is when we register membership of medium, we immediately receive one email notification saying what we have registered.
Let’s first understand the concept using newspaper subscription. I subscribe to a monthly newspaper. I signed a contract with the company and received a newspaper every month. The contract records what I have subscribed to. The company which produces the newspapers will look at the contract and send the product to me each month. I am also able to unsubscribe through their website. In this example, we have three objects, the company producing the products, the receiver(me), and the contract. The important and subtle object is the contract. It’s the contract that connects me and the company together.
The core design idea behind GraphQL is to treat our application as a database. A database is able to return the values restricted by the fields specified in the select statement. GraphQL gives the frontend the options of returning only the fields it specifies.
In the following, we compare GraphQL architecture with the Rest architecture.
In the Rest architecture, there are multiple controllers, facades, services and DAOs. Every controller is responsible for different request mapping. In controllers, we deal with DTO. Facade is usually used for data conversion between DTO and DAO. …
Before talking about Work Stealing, we need to talk about task management. We could use Tomcat as one example. Tomcat will use multiple threads to handle concurrent connections. The number of threads can go very high when there are many concurrent connections at the same time.
However, a computer has a fixed number of cores. The number of threads that could be run at the same time is equal to the number of cores. All other threads have to be in waiting/ready states. The ready state threads will be scheduled to take over the CPU when the current running thread…
This article is based on some basic understanding of Rabbitmq(Queue,Consumer,Producer etc). When communicating with Rabbitmq server, a connection is required. The design of the connection in any framework is more or less the same. The Connection has to wrap a TCP/UDP Socket connection in one way or another. In amqp-client, SocketFrameHandler is used to wrap a TCP Socket.
SocketFrameHandler provides the functionality of reading from and writing to the socket.
Netty is one NIO framework in Java. What Netty provides is the event loop. If you don’t understand what event loop is, please read https://medium.com/@Ryan_Zheng/event-loop-distilled-3a47b9923c66.
NIO In General
In network programming, the server socket needs to bind to a port and network interface. Then the server socket will call accept function. This accept function will return a new Socket when a new client connects to the server. Now the server and client can communicate over this connected socket. The server socket could return to accept function again to wait for other connections.
server = new ServerSocket(port, interface)newSocket = server.accept()
The Channel here we talked about is different from the Channel in Java NIO. NIO Channel is a wrapper around file descriptors. The Channel here is about message sending.
Spring Channel is the fundamental building block of Spring Messaging. Channel is a way to send messages. Here send means literally “send”. That’s why the very top interface of Spring Channel has only send method.
Since MessageChannel is a way to send messages, so who is invoking the send method?
The answer is some other consumer is using the channel to send messages.
But we care about how to connect channels…
Before we are able to understand what event loop is, we have to understand what problem the event loop wants to solve.
Let’s first describe the problem by using one example.
When we open a file for reading, if we synchronously read the content, the current thread will be blocked until the read is successful. There are two modes for file read, synchronous and asynchronous.
Synchronous read: The OS kernel will put the thread onto the wait state and when the kernel finishes the read and puts the read data into the file descriptor buffer, it will wake up this…
There are many articles on the internet explaining what JoinColumn and MappedBy do in Hibernate. But I always find it confusing, and I always forget after a while.
I know that if I keep forgetting something that I learned, that means I didn’t really understand it in the first place.
So today I want to explain what uni-directional, bi-directional from a human-understandable way instead of using a bunch of codes that do not explain the essence.
Let’s use Room, Channels as an example. One Room could have many Channels.
So what is really JoinColumn saying?
JoinColumn basically mandates that it…
I am a software developer who is keen to know how things work