-
-
Save jungleeforce/5cce13484d06370460c7d3bad37e5b52 to your computer and use it in GitHub Desktop.
Publishing an event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dataToPublish = { | |
Some_Text_Field__c: { string: "Test" }, | |
Another_Boolean_Field__c: { boolean: false }, | |
CreatedDate: new Date().getTime(), //This is Required | |
CreatedById: "0057X000003ilJfQAI", //Id of the current user. This is required. | |
}; | |
client.Publish( | |
{ | |
topicName: "/event/Your_Custom_Event__e", | |
events: [ | |
{ | |
id: "124",// this can be any string | |
schemaId: schemaId, //This is the same schemaId that we retrieved earlier. | |
payload: schema.toBuffer(dataToPublish), //The schema here is the avro generated schema | |
}, | |
], | |
}, | |
function (err, response) { | |
if (err) { | |
console.log("error from publishing ", err); | |
} else { | |
console.log("Response ", response); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment