File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ class Kafka {
37
37
let event ;
38
38
try {
39
39
event = JSON . parse ( item . message . value . toString ( 'utf8' ) ) ;
40
+ event = JSON . parse ( event . payload . value ) ;
40
41
} catch ( err ) {
41
42
logger . error ( `"message" is not a valid JSON-formatted string: ${ err . message } ` ) ;
42
43
return ;
@@ -60,7 +61,21 @@ class Kafka {
60
61
}
61
62
62
63
send ( message ) {
63
- return this . producer . send ( { topic : config . TOPIC , message : { value : message } } ) ;
64
+ const data = JSON . stringify ( {
65
+ topic : config . TOPIC ,
66
+ originator : 'topcoder-x-processor' ,
67
+ timestamp : ( new Date ( ) ) . toISOString ( ) ,
68
+ 'mime-type' : 'application/json' ,
69
+ payload : {
70
+ value : message
71
+ }
72
+ } ) ;
73
+ return this . producer . send ( {
74
+ topic : config . TOPIC ,
75
+ message : {
76
+ value : data
77
+ }
78
+ } ) ;
64
79
}
65
80
}
66
81
You can’t perform that action at this time.
0 commit comments