Messaging Queue enables asynchronous communication, where application puts a message onto a message queue and does not require an immediate response to continuing processing.

Image for post
Image for post
Image from Wikipedia

The producer and consumer do not interact directly with each other, but they interact with message queue. This way of handling messages decouples the producer from the consumer so that they do not need to interact with the message queue simultaneously.

In this article, we will look at how to build a simple message queue in Node.js and RabbitMQ.

Initializing Node.js Application

Initialize the application using the following commands:

cd node-queuenpm init -ytouch index.js

Install the AMQP dependency which will be used for integrating Node.js application with RabbitMQ. …


A guide to use Spring Expression Language with @Value annotation.

Image for post
Image for post
Image from Flickr

Spring Expression Language (SpEL) is a powerful expression language, which can be used for querying and manipulating an object graph at runtime. SpEL is available via XML or annotation, is evaluated during the bean creation time.

In this article, we will look at some basic examples of SpEL usage in Spring Boot.

Setting up Spring Boot Application

We will create a simple Spring Boot application and create employee.properties file in the resources directory.

Create a class EmployeeConfig as follows:


Many applications need to run some sort of scheduled tasks for chores like system maintenance, administration, taking a daily backup of data or sending emails. A Cron is a time-based job scheduler, which enables applications to schedule a job to run automatically at a certain date or time.

Image for post
Image for post
Node.js

There are various open source tools available for scheduling cron jobs in Node.js. In this article, we will look at a simple example using a module called node-cron.

Installing Dependencies

In this article, we would be creating a cron job to send emails. Create a simple Node.js …


Multi-threading is similar to multitasking, but enables the processing of executing multiple threads simultaneously, rather than multiple processes. The CompletableFuture, was introduced in Java 8, provides an easy way to write asynchronous, non-blocking and multi-threaded code.

Image for post
Image for post
Spring Boot and Multi-threading

The Future interface which was introduced in Java 5, to handle asynchronous computations. But, this interface did not have any methods to combine multiple asynchronous computations and handle all the possible errors. The CompletableFuture implements Future interface, it can combine multiple asynchronous computations, handle possible errors and offers much more capabilities.

Let’s get down to writing some code and see the benefits.

Create a sample Spring Boot project and add the following dependencies. …


GraphQL has been gaining popularity and it has made its way to the forefront of API development. There are several GraphQL clients available today for front-end frameworks. Apollo client is one of the popular clients for Angular applications.

Image for post
Image for post

In this article, we are going to build a small application using Angular and Apollo client. In my last article, I explained about creating a GraphQL server with Spring Boot. We will use the same example as Graph server for our Angular application.

Creating Angular Application

Let’s create a new Angular project using Angular CLI. Run the following command in a terminal or command prompt.


GraphQL is a query language for APIs that allows clients to request limited data they need, making it possible for clients to gather data in a limited number of requests. GraphQL is strongly typed protocol and all data operations are validated against a GraphQL schema.

Image for post
Image for post

In this article, we will build a simple GraphQL server with Spring Boot.

Adding Maven Dependencies

Create a sample Spring Boot application and add the following dependencies.

  1. graphql-spring-boot-starter is used for enabling GraphQL servlet and it becomes available at a path /graphql. It initializes GraphQLSchema bean.
  2. graphql-java allows to write schema with GraphQL schema language which is simple to understand. …


Most communications between microservices is either via HTTP request-response APIs or asynchronous messaging. While these two mechanisms are most commonly used, yet they’re quite different. It is important to know when to use which mechanism.

Image for post
Image for post
Spring Boot and ActiveMQ

Event-driven communication is important when propagating changes across several microservices and their related domain models. This means that when changes occur, we need some way to coordinate changes across the different models. This ensures reliable communication as well as loose coupling between microservices.

There are multiple patterns to achieve event-driven architecture. One of the common and popular one is messaging pattern. This is extremely scalable, flexible and guarantee delivery of messages. …


Batch processing of data is an efficient way of processing large volumes of data where data is collected, processed and then batch results are produced. Batch processing can be applied in many use cases. One common use case of batch processing is transforming a large set of flat, CSV or JSON files into a structured format that is ready for further processing.

Image for post
Image for post
Spring Boot and Spring Batch

In this article, I am going to demonstrate batch processing using one of the projects of Spring which is Spring Batch. Spring Batch provides functions for processing large volumes of data in batch jobs. …


Most of the applications today serve users across the globe and need a way to deliver their content fast. The content can be images, videos, PDF and so on. Content delivery network (CDN) is a network of servers that are geographically distributed with the intent of serving content to users as fast as possible.

Image for post
Image for post
Image from Wikipedia

Amazon CloudFront is a content delivery network service which can deliver content fast and secure. In this article, I will describe how to upload files to S3 bucket and serve those files through CloudFront in Node.js. CloudFront will use S3 as an origin in this article.

Prerequisites

Create a bucket in S3 and create a CloudFront distribution in AWS. I will not go into detail about creating S3 bucket and CloudFront distribution in this article. Navigate to IAM and go to ‘Security Credentials’ under user. Create an access key and download the CSV file in case you don’t already have one. …


Streaming data is a radical new approach to sending data to web browsers which provides for dramatically faster page load times.

Image for post
Image for post
Spring and Spring Boot

Quite often, we need to allow users to download files in web applications. When the data is too large, it becomes quite a challenge to provide a good user experience.

Spring offers support for asynchronous request processing via StreamingResponseBody. In this approach, application can write data directly to the response OutputStream without holding up the Servlet container thread. There are a few other methods in Spring to handle asynchronous request processing.

In this article, we are going to look at an example to download files using StreamingResponseBody. In this approach, data is processed and written in chunks to the OutputStream. …

About

Swathi Prasad

Hey, I am Swathi. A software developer since 2010. I am a programming addict. I love learning and sharing knowledge. https://techshard.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store