An open API service indexing awesome lists of open source software.

https://github.com/pramithamj/microcomms

A Lightweight Microservices Communication Helper for Go A Go package for handling HTTP requests, gRPC communication, message queues (RabbitMQ, Kafka, NATS), and service discovery (Consul, etcd) with built-in retries, authentication, logging, and tracing.
https://github.com/pramithamj/microcomms

golang package

Last synced: 2 months ago
JSON representation

A Lightweight Microservices Communication Helper for Go A Go package for handling HTTP requests, gRPC communication, message queues (RabbitMQ, Kafka, NATS), and service discovery (Consul, etcd) with built-in retries, authentication, logging, and tracing.

Awesome Lists containing this project

README

        

# Microcomms - Microservices Communication Helper

**Microcomms** is a Go package designed to simplify microservices communication. It provides modules for handling HTTP requests, gRPC communication, message queues (RabbitMQ, Kafka, NATS), and service discovery (Consul, etcd), all with built-in retries, authentication, logging, and distributed tracing.

---

## 🚀 Features

- **HTTP Client**: Simplified HTTP requests with retries, OAuth, JWT authentication, and logging.
- **gRPC Client**: Easy-to-use gRPC client with connection pooling, retries, and authentication.
- **Message Queues**: Supports RabbitMQ, Kafka, and NATS for messaging and communication.
- **Service Discovery**: Integrates with Consul and etcd for dynamic service discovery.
- **Logging & Tracing**: Unified logging and OpenTelemetry-based distributed tracing.

---

## 📦 Installation

To install **Microcomms**, run the following command:

```sh
go get github.com/pramithamj/microcomms
```

### **What Makes Microcomms Unique:**

#### 1. **Multi-Protocol Support (HTTP, gRPC, MQ, Discovery)**
- Unlike other packages that focus only on one communication method (like HTTP or gRPC), **Microcomms** offers **multi-protocol support**: HTTP, gRPC, message queues (RabbitMQ, Kafka, NATS), and service discovery (Consul, etcd).
- This allows users to integrate seamlessly into a variety of architectures and allows them to choose the best communication protocol for each use case.

#### 2. **Unified Client Interface**
- **Microcomms** can provide a **unified client** interface for all communication methods (HTTP, gRPC, MQ). This reduces friction for developers, as they only need to learn one API to handle multiple protocols.
- For example, a `Client` struct could have methods like `Send()` which decides on the protocol (HTTP, gRPC, etc.) based on configuration.

#### 3. **Built-in Resilience (Retries, Circuit Breakers)**
- **Automatic retries**, **backoff strategies**, and **circuit breakers** are included in the package. This ensures reliability in distributed systems where network failures or service downtimes can happen.
- This feature can be especially unique if implemented as a **cross-protocol feature**, meaning retries work seamlessly across both HTTP and gRPC, and MQ operations.

#### 4. **Service Discovery Integration (Consul, etcd)**
- The integration with **Consul** and **etcd** for **dynamic service discovery** sets your package apart. While many microservice packages focus only on static configurations or manual service management, **Microcomms** enables **auto-discovery** of services, which is crucial in cloud-native or dynamic environments like Kubernetes.

#### 5. **Distributed Tracing & Logging (Out-of-the-box)**
- The package could include automatic support for **OpenTelemetry** for **distributed tracing** and **structured logging** using libraries like **Zerolog**.
- This unique feature helps developers track and debug microservice communication flows across systems with minimal setup.

#### 6. **Message Queue Integration (RabbitMQ, Kafka, NATS)**
- **Microcomms** can uniquely offer support for **multiple messaging systems** like RabbitMQ, Kafka, and NATS. Not all microservice communication packages include support for messaging queues out of the box, especially in a way that supports **scalable, real-time messaging**.

#### 7. **Lightweight & Easy-to-Use**
- Many microservices communication packages can be heavy, complex, and require extensive configuration. Microcomms can emphasize being **lightweight**, easy to use, and having **sensible defaults** with flexibility for advanced configuration.
- This simplicity with extensibility can be its key selling point.

---

### **Additional Features to Add for Microcomms:**

#### 1. **Flexible Protocol Switching**
- Allow users to **switch protocols dynamically** within the same client. For example, if the HTTP service becomes unavailable, it could automatically fall back to gRPC or MQ without the developer having to manage it manually.

#### 2. **Client Connection Pooling**
- Implement **connection pooling** for both HTTP and gRPC clients to reduce overhead and improve performance in environments where many requests are made.

#### 3. **Encryption and Authentication Built-In**
- Out-of-the-box support for **TLS encryption** for HTTP and gRPC.
- Authentication mechanisms (like OAuth2, JWT) for **secure communication** can be handled automatically by the package, reducing the burden on developers.

#### 4. **Load Balancing**
- Implement automatic **load balancing** with support for **round-robin** or **random** selection of services in a service discovery setup. This will help ensure requests are distributed evenly across service instances.

#### 5. **Async and Stream Support (for gRPC and MQ)**
- **Async** support for **gRPC streams** and **message queues** would allow consumers to listen to events/messages continuously without blocking. This is crucial for real-time applications where responses are not immediate.

#### 6. **Metrics and Monitoring**
- Include **prometheus-compatible metrics** that monitor request times, successes/failures, retries, etc. This would help in **observability** and understanding the performance of communication within microservices.

#### 7. **Extensive Documentation**
- Provide **step-by-step guides** for each communication protocol (HTTP, gRPC, MQ), along with **advanced examples** for integrating **service discovery** and **message queues**.
- Offer **best practices** for building resilient, high-performance microservice architectures using **Microcomms**.

#### 8. **CLI Tool for Quick Testing**
- Add a **CLI tool** (`microcomms-cli`) to quickly test and send HTTP/gRPC requests or MQ messages using the package. This helps in quickly debugging and validating the setup.

#### 9. **Rate Limiting & Throttling**
- Implement **rate limiting** to avoid overwhelming backend services with too many requests and control the **throttling** of requests. This can be particularly useful when integrating APIs that have request limits.

#### 10. **Extensibility via Plugins**
- Allow **plugin-based architecture** to extend the package with custom communication protocols or custom retry/backoff strategies. This provides users with more flexibility as their application grows.

---

### **Conclusion**

To make **Microcomms** stand out, focus on providing:
- **Comprehensive, multi-protocol support**
- **Resilience** with features like retries and circuit breakers
- **Ease of use** with unified clients, sensible defaults, and clear documentation
- **Advanced observability** tools like logging and tracing

These unique features combined with enhancements such as flexible protocol switching, security, and integration with monitoring systems will differentiate **Microcomms** from other Go packages for microservice communication! 🚀