Skip to main content
POST
{MOCK_ADAPTER_URL}
/
api
/
kafka-exchanges
/
curl -X POST '{MOCK_ADAPTER_URL}/api/kafka-exchanges/' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "incomingTopic": "ai.flowx.in.adapter.kyc.clientCheckPf.v1",
    "outgoingTopic": "to.flowx.updates.qa.adapter.kyc.clientcheck.v1",
    "receivedMessageJson": null,
    "sentMessageJson": "{ \"status\": \"success\", \"response\": [] }"
  }'
{
  "id": "mock_exchange_123",
  "incomingTopic": "ai.flowx.in.adapter.kyc.clientCheckPf.v1",
  "outgoingTopic": "to.flowx.updates.qa.adapter.kyc.clientcheck.v1",
  "receivedMessageJson": null,
  "sentMessageJson": "{ \"status\": \"success\", \"response\": [] }",
  "createdAt": "2024-01-15T10:30:00Z",
  "isActive": true
}
This endpoint allows you to create a new Kafka exchange mock that simulates the message flow between FlowX Engine and external integrations. Use this during development and testing to mock third-party system responses without requiring actual external services.
Kafka mocks are essential for testing process flows that depend on external integrations, allowing you to simulate various response scenarios and edge cases.

Authentication

This endpoint requires Bearer Token authentication. Include your API token in the Authorization header.
Authorization
string
required
Bearer token for API authentication. Format: Bearer YOUR_API_TOKEN

URL Parameters

mock-adapter-url
string
required
The base URL of the mock adapter service where Kafka exchange mocks are managed.

Request Body Parameters

incomingTopic
string
required
The Kafka topic name that the external integration listens on for incoming messages from FlowX Engine. This should match exactly with your integration’s configuration.Example: ai.flowx.in.adapter.kyc.clientCheckPf.v1
outgoingTopic
string
required
The Kafka topic name that FlowX Engine listens on for replies from the external integration. This should match the topic configured in your process definition.Example: to.flowx.updates.qa.adapter.kyc.clientcheck.v1
sentMessageJson
string
required
The JSON message that will be sent to the external integration. Use null if you want to test scenarios where no specific message content is required, or provide a JSON string for specific message simulation.
receivedMessageJson
string
required
The JSON response message that the mock will return to FlowX Engine, simulating the external integration’s response. This allows you to test different response scenarios.

Request Example

curl -X POST '{MOCK_ADAPTER_URL}/api/kafka-exchanges/' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "incomingTopic": "ai.flowx.in.adapter.kyc.clientCheckPf.v1",
    "outgoingTopic": "to.flowx.updates.qa.adapter.kyc.clientcheck.v1",
    "receivedMessageJson": null,
    "sentMessageJson": "{ \"status\": \"success\", \"response\": [] }"
  }'
const response = await fetch('{MOCK_ADAPTER_URL}/api/kafka-exchanges/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    incomingTopic: 'ai.flowx.in.adapter.kyc.clientCheckPf.v1',
    outgoingTopic: 'to.flowx.updates.qa.adapter.kyc.clientcheck.v1',
    receivedMessageJson: null,
    sentMessageJson: '{ "status": "success", "response": [] }'
  })
});

Response Examples

{
  "id": "mock_exchange_123",
  "incomingTopic": "ai.flowx.in.adapter.kyc.clientCheckPf.v1",
  "outgoingTopic": "to.flowx.updates.qa.adapter.kyc.clientcheck.v1",
  "receivedMessageJson": null,
  "sentMessageJson": "{ \"status\": \"success\", \"response\": [] }",
  "createdAt": "2024-01-15T10:30:00Z",
  "isActive": true
}
{
  "error": "Invalid request",
  "message": "incomingTopic is required and must be a valid topic name",
  "code": "INVALID_TOPIC_NAME"
}
{
  "error": "Unauthorized",
  "message": "Invalid or missing authentication token"
}

Usage Tips

Testing Different Scenarios: Create multiple mocks with different sentMessageJson values to test various response scenarios like success, failure, and edge cases in your process flows.
Topic Naming: Ensure your topic names follow your organization’s Kafka topic naming conventions and match exactly with your integration configurations.
Mock exchanges are intended for development and testing environments only. Do not use mocked integrations in production systems.
⌘I