Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 36f3f24

Browse files
author
James Cori
committed
Merge branch 'develop'
2 parents a958b4c + 4dcd1fd commit 36f3f24

File tree

5 files changed

+404
-308
lines changed

5 files changed

+404
-308
lines changed

src/app.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const consumer = new Kafka.GroupConsumer(helper.getKafkaOptions())
2424
*/
2525
const dataHandler = (messageSet, topic, partition) => Promise.each(messageSet, async (m) => {
2626
const message = m.message.value.toString('utf8')
27-
logger.info(`Handle Kafka event message; Topic: ${topic}; Partition: ${partition}; Offset: ${
28-
m.offset}; Message: ${message}.`)
27+
// logger.info(`Handle Kafka event message; Topic: ${topic}; Partition: ${partition}; Offset: ${
28+
// m.offset}; Message: ${message}.`)
2929
let messageJSON
3030
try {
3131
messageJSON = JSON.parse(message)
@@ -39,7 +39,7 @@ const dataHandler = (messageSet, topic, partition) => Promise.each(messageSet, a
3939
}
4040

4141
if (messageJSON.topic !== topic) {
42-
logger.error(`The message topic ${messageJSON.topic} doesn't match the Kafka topic ${topic}.`)
42+
logger.error(`The message topic ${messageJSON.topic} doesn't match the Kafka topic ${topic}. Message: ${JSON.stringify(messageJSON)}`)
4343

4444
// commit the message and ignore it
4545
await consumer.commitOffset({ topic, partition, offset: m.offset })
@@ -64,13 +64,14 @@ const dataHandler = (messageSet, topic, partition) => Promise.each(messageSet, a
6464

6565
try {
6666
if (topic === config.CREATE_CHALLENGE_TOPIC) {
67-
await ProcessorService.processCreate(messageJSON)
67+
await ProcessorService.processMessage(messageJSON)
6868
} else {
69-
await ProcessorService.processUpdate(messageJSON)
69+
await ProcessorService.processMessage(messageJSON)
7070
}
7171

72-
logger.debug('Successfully processed message')
72+
// logger.debug('Successfully processed message')
7373
} catch (err) {
74+
logger.error(`Error processing message ${JSON.stringify(messageJSON)}`)
7475
logger.logFullError(err)
7576
} finally {
7677
// Commit offset regardless of error

0 commit comments

Comments
 (0)