Archived | Integrate RabbitMQ and Redis Cluster with a blockchain network

Get the code View the demo

Archived content

Archived date: 2019-05-01

This content is no longer being updated or maintained. The content is provided “as is.” Given the rapid evolution of technology, some content, steps, or illustrations may have changed.

Summary

You’ve made it to the fourth in a series of IBM Code patterns that teach you how to get started creating a blockchain application with Hyperledger Fabric Node SDK. Now that you know how to create the network and define network operations, you’re ready to learn how to integrate RabbitMQ and Redis Cluster to scale your blockchain application. Let’s get started with optimizing our blockchain application to handle a large number of requests.

Description

All good developers know scaling is critical to the application development process. Scalability is a measure of efficiency as a given load increases in size. It is something that should be considered from the start of the design and development process and not an afterthought. You don’t want to set limitations on your applications. Additionally, you need to consider that data may be processed in parallel and federated across multiple sources. In this developer pattern, we will configure Redis and Rabbit to scale and regulate the data processing that occurs between the IoS application front-end application and the blockchain back end. With the direct use of REST API calls, it is not possible to control the number of requests sent to a blockchain network because it might cause read/write conflicts, etc. To control the flow of requests sent to the blockchain network and scale our application, we will do two things:

  1. Use RabbitMQ cluster with the nodes consisting of mirrored queues to order the user requests.
  2. Use Redis Cluster with six nodes (three master and three slaves), where the results are temporarily stored.

In the architecture diagram, we have the RabbitMQ producer present in API containers that queue the requests to the RabbitMQ cluster. The RabbitMQ consumer is configured with an instance of Hyperledger Fabric Node SDK in task execution containers to consume the requests from users and send to the blockchain network for execution.

Flow

flow

  1. Create and start the blockchain application.
  2. Perform transactions on the blockchain network.
  3. View results and transaction blocks created in the blockchain network.

Instructions

Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.