Set Up Messaging Channels for Your Ledger Environment

Messaging channels are a crucial component of your ledger environment, enabling seamless real-time communication between systems. These channels facilitate efficient transaction processing, system monitoring, and integration with external services.

1. Why Messaging Channels Matter?

  • Enable both asynchronous and synchronous messaging (e.g., ledger operations, status updates).

  • Support integration with external systems such as payment engines and reporting services.

  • Ensure scalability by processing large volumes of messages efficiently.

2. Understanding Messaging Requirements

Before setting up a messaging channel, define the following:

  • Message Type: What data will be transmitted? (e.g., transactions, audit logs).

  • Communication Protocol:

    • Kafka for high-volume, event-driven messaging.

    • HTTP APIs for direct, synchronous integration.

  • Topics/Endpoints:

    • Kafka - Define request and response topics.

    • HTTP - Specify URL endpoints for messages.


3. Creating Messaging Channels

Kafka Channels (Recommended for high-volume, real-time processing)

1️⃣ Create a Kafka Channel This command creates a Kafka messaging channel:

./luca create-channel KAFKA ledger_channel \
    --c:request-topic=ledger-requests \
    --c:response-topic=ledger-responses

2️⃣ Validate the Kafka Channel Verify all configured Kafka channels:

./luca list-channels KAFKA

3️⃣ Activate the Kafka Channel Transition the Kafka channel to an active state:

./luca transition /service/cac-ledger/KAFKA/ledger_channel OPEN

HTTP Channels (For direct API-based communication)

1️⃣ Create an HTTP Channel Set up an HTTP-based messaging channel:

./luca create-channel HTTP ledger_http_channel \
    --c:request-endpoint=https://api.example.com/ledger-requests

2️⃣ Validate the HTTP Channel List all available HTTP channels:

./luca list-channels HTTP

3️⃣ Test the Endpoints Ensure the HTTP endpoints are operational using cURL:

curl -X POST -H "Content-Type: application/json" \
-d '{"message":"test"}' https://api.example.com/ledger-requests

4. Testing Your Messaging Channel

After setting up the channels, test them to confirm proper functionality.

Kafka Channel Test

  • Use a Kafka producer to send a test message:

    kafka-console-producer --broker-list localhost:9092 --topic ledger-requests
  • If the response appears on the ledger-responses topic, the channel is active.

HTTP Channel Test

  • Send a test request using cURL:

    curl -X POST -H "Content-Type: application/json" \
    -d '{"transaction_id":"12345"}' https://api.example.com/ledger-requests
  • Check for a valid response from the same request endpoint.

    .


5. Verifying Channel Status in Ledger

Ensure that the channels are active and available using the following command:

./luca read-channels

6. Common Issues & Solutions

Issue
Cause
Solution

Channel Not Found

Incorrect channel name

Use ./luca list-channels to verify.

Messages Not Delivered

Incorrect topic configuration

Check Kafka logs or HTTP response codes.

Channel Transition Issues

Channel not in OPEN state

Use ./luca transition /service/cac-ledger/KAFKA/<channel_name> OPEN.


7. Managing Kafka Topics

Kafka topics serve as communication channels for requests, responses, and events within the ledger system. They enable:

  • Real-time, event-driven workflows.

  • Large-scale processing of transactions and system monitoring.

  • Fault tolerance through replication and retention policies.

Example Kafka Topics:

Topic Name
Description
Partitions
Retention

queue.cac.ledger-request.v1

Ledger transaction requests

2500

6 hours

queue.cac.ledger-response.v1

Ledger transaction responses

500

6 hours

queue.cac.ledger-movement.v1

Tracks fund movements

10

6 hours

queue.cac.ledger-request-priority.v1

High-priority transactions

10

Default

queue.cac.ledger-response-priority.v1

Priority transaction responses

10

Default



Last updated