Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* Gates Foundation
- Name Surname
* Lazola Lucas
* Rajiv Mothilal
* Miguel de Barros
--------------
******/
'use strict'
/**
* @module src/handlers/lib/kafka
*/
const Consumer = require('@mojaloop/central-services-stream').Kafka.Consumer
const Logger = require('@mojaloop/central-services-shared').Logger
const ErrorHandler = require('@mojaloop/central-services-error-handling')
const listOfConsumers = {}
/**
* @function CreateHandler
*
* @param {string} topicName - the topic name to be registered for the required handler. Example: 'topic-dfsp1-transfer-prepare'
* @param {object} config - the config for the consumer for the specific functionality and action, retrieved from the default.json. Example: found in default.json 'KAFKA.CONSUMER.TRANSFER.PREPARE'
* @param {function} command - the callback handler for the topic. Will be called when the topic is produced against. Example: Command.prepareHandler()
*
* @description Parses the accountUri into a participant name from the uri string
*
* @returns {object} - Returns a Promise
* @throws {Error} - if failure occurs
* Gates Foundation
- Name Surname
* Rajiv Mothilal
* Miguel de Barros
--------------
******/
'use strict'
/**
* @module src/handlers/lib/kafka
*/
const Producer = require('@mojaloop/central-services-stream').Kafka.Producer
const Logger = require('@mojaloop/central-services-shared').Logger
const ErrorHandler = require('@mojaloop/central-services-error-handling')
const listOfProducers = {}
/**
* @function ProduceMessage
*
* @param {string} messageProtocol - message being created against topic
* @param {object} topicConf - configuration for the topic to produce to
* @param {object} config - Producer configuration, eg: to produce batch or poll
*
* @description Creates a producer on Kafka for the specified topic and configuration
*
* @returns {boolean} - returns true if producer successfully created and producers to
* @throws {error} - if not successfully create/produced to