How to use the @mojaloop/central-services-stream.Kafka function in @mojaloop/central-services-stream

To help you get started, we’ve selected a few @mojaloop/central-services-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mojaloop / central-ledger / src / handlers / lib / kafka / consumer.js View on Github external
* 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
github mojaloop / central-ledger / src / handlers / lib / kafka / producer.js View on Github external
* 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

@mojaloop/central-services-stream

Streaming library code for central services.

Apache-2.0
Latest version published 4 days ago

Package Health Score

76 / 100
Full package analysis