liveBook · Manning

Amqplib

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

amqplib is a Node.js client library for connecting to and communicating with AMQP message brokers such as RabbitMQ.

amqplib is a Node.js npm client library for configuring RabbitMQ and sending or receiving messages through AMQP. It lets microservices communicate indirectly through queues or exchanges rather than calling one another directly. section 5.1 section 5.8.2

Connecting a microservice

A Docker Compose service can configure RABBIT as amqp://guest:guest@rabbit:5672. Because RabbitMQ may start more slowly than the Node.js service, wait for rabbit:5672 before launching the application with wait-port.

Table 5.1 New and familiar tools in chapter 5 (view table figure)

Tool

Version

Purpose

Docker Compose

Included with Docker 24.0.5

Docker Compose lets us configure, build, run, and manage multiple containers at the same time.

HTTP

1.1

HTTP is used to send direct (or synchronous) messages from one microservice to another.

RabbitMQ

3.12.4

RabbitMQ is the message-queuing software that we’ll use to send indirect (or asynchronous) messages from one microservice to another.

amqplib

0.10.3

This npm package allows us to configure RabbitMQ and to send and receive messages from JavaScript.

Compare amqplib with RabbitMQ, HTTP, and Docker Compose, including their roles and stated versions. section 5.1

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Demonstrates installation, URI configuration, connection, channel creation, and startup coordination, but defers automatic reconnection.
Examples
Uses a history microservice, the RABBIT URI, amqp.connect, createChannel, Docker Compose, and wait-port.
What it assumes
Assumes Node.js, npm, Docker Compose, environment variables, and RabbitMQ basics while introducing the amqplib connection workflow.
What you can do after
Operate/configure a Node.js microservice to connect with RabbitMQ and prepare a channel for message communication.
How it connects
Connects Node.js, RabbitMQ, AMQP, microservices, message queues, message exchanges, Docker Compose, and HTTP.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.