diff --git a/udfs/insert_attributes.js b/udfs/insert_attributes.js index 061df99c..678670d5 100644 --- a/udfs/insert_attributes.js +++ b/udfs/insert_attributes.js @@ -1,23 +1,18 @@ /* - * This UDF is used to insert three new attributes into the message metadata. + * This UDF is used to insert three new attributes into the message. * * @param {Object} message - The message to insert attributes into. - * @param {Object} metadata - The metadata to modify. - * @returns {Object} The message with new attributes in metadata. + * @param {Object} metadata - The metadata of the message. + * @returns {Object} The message with new attributes. */ function insert_attributes(message, metadata) { - // Parse the message - const data = JSON.parse(message.data); const attributes = message.attributes; - // Add new attributes to insert + // Add new attributes attributes["key1"] = 'value1'; attributes["key2"] = 'value2'; - attributes["key3"] = 'value3'; + attributes["key3"] = 'value3'; - // Update the message with modified data - message.data = JSON.stringify(data); - return message; }