How to use the kafkajs.producers.forEach function in kafkajs

To help you get started, we’ve selected a few kafkajs 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 al66 / imicros-flow / test / flow.static.subscriber.old.js View on Github external
subscriptions = [{
                id: "step.one"  + timestamp ,
                event: "test.emit",
                emit: {
                    topic: "next",
                    event: "test.emit.received"
                }
            }];    
            service = broker.createService(Subscriber, Object.assign({ settings: { brokers: ["192.168.2.124:9092"], subscriptions: subscriptions } }));
            await broker.start();  
            let content = { 
                meta: opts.meta, 
                event: "test.emit",
                payload: { msg: "say hello to the world" },
            };
            producers.forEach(producer => { producer.fail = true; });
            mock.__emittedEventReset();
            try {
                await mock.__emit("events", 10, content);
            } catch (err) {
                expect(err.message).toBe("simulated fail of producer.send");
            }
            let emittedEvent = mock.__emittedEvent();    
            expect(emittedEvent).toEqual(null); 
        });

kafkajs

A modern Apache Kafka client for node.js

MIT
Latest version published 2 years ago

Package Health Score

81 / 100
Full package analysis