Skip to content

Commit 8a015f9

Browse files
Merge pull request #119 from topcoder-platform/Issue_115
Store original topic in payload when posting to aggregate topic
2 parents e0ef244 + 38e85f7 commit 8a015f9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/common/helper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,21 @@ function * downloadFile (fileURL) {
520520
/**
521521
* Wrapper function to post to bus api. Ensures that every event posted to bus api
522522
* is duplicated and posted to bus api again, but to a different "aggregate" topic
523+
* Also stores the original topic in the payload
523524
* @param {Object} payload Data that needs to be posted to the bus api
524525
*/
525526
function * postToBusApi (payload) {
526527
const busApiClient = getBusApiClient()
528+
const originalTopic = payload['topic']
527529

528530
yield busApiClient.postEvent(payload)
529531

530532
// Post to aggregate topic
531533
payload['topic'] = config.get('KAFKA_AGGREGATE_TOPIC')
532534

535+
// Store the original topic
536+
payload['payload']['originalTopic'] = originalTopic
537+
533538
yield busApiClient.postEvent(payload)
534539
}
535540

0 commit comments

Comments
 (0)