@@ -37,19 +37,21 @@ async function getClient() {
3737/**
3838 * Creates a new event in Bus API
3939 * Any errors will be simply ignored
40- * @param {String } type the event type , should be a dot separated fully qualitied name
41- * @param {Object } message the message , should be a JSON object
40+ * @param {String } topic the event topic , should be a dot separated fully qualitied name
41+ * @param {Object } payload the payload , should be a JSON object
4242 * @param {Object } logger object
4343 * @return {Promise } new event promise
4444 */
45- function createEvent ( type , message , logger ) {
46- const body = JSON . stringify ( message ) ;
47- logger . debug ( `Sending message: ${ JSON . stringify ( message ) } ` ) ;
45+ function createEvent ( topic , payload , logger ) {
46+ logger . debug ( `Sending message: ${ JSON . stringify ( payload ) } ` ) ;
4847 return getClient ( ) . then ( ( busClient ) => {
4948 logger . debug ( 'calling bus-api' ) ;
5049 return busClient . post ( '/bus/events' , {
51- type,
52- message : body ,
50+ topic,
51+ originator : 'tc-project-service' ,
52+ timestamp : ( new Date ( ) ) . toISOString ( ) ,
53+ 'mime-type' : 'application/json' ,
54+ payload,
5355 } ) . then ( ( resp ) => {
5456 logger . debug ( 'Sent event to bus-api' ) ;
5557 logger . debug ( `Sent event to bus-api [data]: ${ resp . data } ` ) ;
0 commit comments