Light-4j is the main component in Light. It contains a client, a server and all common HTTP cross-cutting concerns implemented in the request/response chain as middleware handlers. An embedded gateway is established in the same server process by injecting these middleware handlers between the client and server in the HTTP channel via configuration in the DevOps process to gain higher performance and a lower memory footprint. This allows developers to focus only on business logic to achieve higher productivity.
Read More »
When deploying microservices to the cloud, there are two different ways for service to service communication within an organization. Most people are familiar with the synchronous request/response style of communication like REST, GraphQL or RPC. However, more organizations are adopting asynchronous message/command/event-based communication with Event Sourcing and CQRS to ensure data consistency across services. Each service will have some endpoints to serve the consumer’s calls over the HTTP and maintain the data consistency with other services as each service is managing the data independently.
Read More »
Most of our customers build API or microservices to serve Single Page Application on Browser or Native applications on devices. For security reasons, we normally don’t send JWT tokens to Browser unless JWE is applied. In order to secure the SPA, the session will be used between Browser and Web Server. For high availability, we need to have multiple instances of web servers behind a reverse proxy (F5, etc.), and sessions need to be replicated between all instances.
Read More »
Light-4j is built on top of Undertow core and supports Websocket natively without going through Java EE stack. So the performance is much better than other servers in terms of throughput and latency. There are two examples in light-example-4j to demo client-to-server and peer-to-peer WebSocket.
Both projects have been upgraded to the light-4j 2.0.x with Java 11 support. To build and run them, run the following command lines.
client-to-server cd ~/networknt/light-example-4j/websocket/client-to-server mvn clean install exec:exec Open a browser and paste the address http://localhost:8080 and you can send WebSocket message to the server.
Read More »
Most people think that light-4j and related frameworks are API frameworks and can only build different styles of APIs or microservices. In fact, light-4j is a very fast web server that is optimized to serve static content and single page applications built with Angular, React or Vue. Also, the web server supports [distributed session][] with Hazelcast, Redis or SQL database.
Read More »
For most organizations, switching from a monolithic architecture to microservices is really hard as the initial infrastructure investment is very high, and almost all the design patterns in Java EE are anti-patterns in microservices. It might be easier to start with modularized monolithic and then split each module to separate instances as microservices once volume picks up. The light-hybrid-4j is designed for it. It takes advantage of both monolithic and microservices with a simple RPC style of interaction between services.
Read More »
Light provides a plugin architecture and dozens of middleware handlers to address cross-cutting concerns in general. When you decide to build an API or service, you have to choose from different styles and the corresponding frameworks.
Chances are you are building a public Web API and want to follow RESTful style to make sure everyone can understand and consume it.
The light-rest-4j is a framework that is designed to speed up RESTful API development and deployment.
Read More »
Recently, one big customer asked if we can integrate light-4j middleware handlers to address cross-cutting concerns to Spring Boot applications. They want to leverage the light-4j middleware handlers as they are faster, smaller and easier to implement and customize. Most importantly, these handlers are working with Light infrastructure to form an ecosystem to support microservices architecture. In this way, they can migrate their existing Spring Boot applications to Light without changing the controllers and business logic.
Read More »
When building APIs that are consumed by Single Page Applications running on browsers, security control is different from service to service calls. This repository contains all the middleware handlers designed for SPA only. It automatically renews the JWT token from the OAuth 2.0 provider before the token expires and handles the CSRF token to prevent cross-site request forgery attacks.
The embedded handler also handles the login and logout from the UI and manages the session with cookies.
Read More »
GraphQL is a new style of protocol open-sourced by Facebook, and it is getting popular, especially in Mobile and Single Page Application as the front end. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
Light-graphql-4j is a framework that is designed to work with GraphQL.
Read More »
This is not an open-source component, so it is only available for paid customers. We have some enterprise customers who still have so many applications or services built on top of the Java EE platform with IBM MQ to integrate between applications across domains. To leverage these applications and services, we were asked to develop a light-4j component that can easily connect to the MQ to produce/consume messages.
Features Security first design with all connections authenticated and authorized.
Read More »
In Light, we are using the middleware handlers to address cross-cutting concerns for microservices in the request/response chain in the same service process or within a light-mesh/http-sidecar at the network level.
With more and more serverless Lambda functions deployed to the AWS cloud, we need to find a way to address the cross-cutting concerns in the same fashion as the light-4j so that the Lambda functions can be integrated with the Light ecosystem for security, logging, tracing, auditing and metrics.
Read More »
Inspired by Chaos Engineering at Netflix and Chaos Monkey for Spring Boot.
The Goal of Chaos Monkey While helping my customers to build large scale distributed systems in light-4j, I constantly receive the following questions:
Will the fallback work? How would the application behave with network latency? What will happen if one of the service instances is down? How does the service discovery help during service deployment? As you can see, there are a lot of questions to be answered to make our customers comfortable to rollout distributed applications.
Read More »
In microservices architecture, it is recommended that each service has its own database. Some business transactions, however, span multiple service so you need a mechanism to ensure data consistency across services. How to maintain data consistency across services? In microservices architecture, we don’t havethe luxury of XA transaction.
The answer is Saga which is a sequence of local transactions. Each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga.
Read More »
The foundation of the Service Broker programming model is transactional messaging. Any operation that involves Service Broker is part of the current transaction. Service Broker does not commit a messaging operation until the current transaction commits. If the transaction rolls back, the Database Engine guarantees that all messaging operations that are part of the transaction also roll back. An application manages messaging operations as part of managing SQL Server transactions.
Read More »
When building an application based on microservices architecture, there are two major patterns for service to service communication.
Serivce to Service communication Synchronous, Request/Response Communication In light-4j, this means to use Client module to call other services in the request/response fashion regardless light-rest-4j, light-graphql-4j or light-hybrid-4j is used.
Asynchronous, Message-Based Communication The eventual consistency framework light-eventuate-4j is designed to facilitate asynchronous communication between services built on top of light-rest-4j, light-grahpql-4j and light-hybrid-4j.
Read More »