File tree 5 files changed +17
-7
lines changed
5 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ workflows:
77
77
context : org-global
78
78
filters :
79
79
branches :
80
- only : ['dev']
80
+ only : ['dev', 'feature/shapeup3' ]
81
81
- " build-prod " :
82
82
context : org-global
83
83
filters :
Original file line number Diff line number Diff line change 1
1
# Topcoder Bus API Server
2
2
3
- ## Overview
3
+ ## Overview
4
4
5
5
A meta service, Topcoder Bus API server provides information about other services offered by Topcoder.
6
6
Original file line number Diff line number Diff line change @@ -979,6 +979,10 @@ definitions:
979
979
type : " string"
980
980
example : " application/json"
981
981
description : " Mime-type for 'payload'.\n "
982
+ key :
983
+ type : " string"
984
+ example : " abc123"
985
+ description : " optional field to assure the one partition for 'payload'.\n "
982
986
payload :
983
987
type : " object"
984
988
example :
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ function validateEventPayload (event) {
133
133
originator : Joi . string ( ) . required ( ) ,
134
134
timestamp : Joi . string ( ) . required ( ) ,
135
135
'mime-type' : Joi . string ( ) . required ( ) ,
136
+ key : Joi . string ( ) ,
136
137
payload : Joi . any ( )
137
138
} )
138
139
} )
Original file line number Diff line number Diff line change @@ -30,12 +30,17 @@ async function postEvent (event) {
30
30
helper . validateEventPayload ( event )
31
31
32
32
// Post new structure
33
- const result = await producer . send ( {
33
+ const message = {
34
+ value : JSON . stringify ( event )
35
+ }
36
+ if ( event . key ) {
37
+ _ . merge ( message , { key : event . key } )
38
+ }
39
+ const kafkaPayload = {
34
40
topic : event . topic ,
35
- message : {
36
- value : JSON . stringify ( event )
37
- }
38
- } )
41
+ message
42
+ }
43
+ const result = await producer . send ( kafkaPayload )
39
44
// Check if there is any error
40
45
const error = _ . get ( result , '[0].error' )
41
46
if ( error ) {
You can’t perform that action at this time.
0 commit comments