Add attributes to the output of the PubSub-In node
Closed this issue · 4 comments
Today the data
property of the PubSubMessage is mapped to msg.payload
.
https://github.com/GoogleCloudPlatform/node-red-contrib-google-cloud/blob/master/pubsub-in.js#L77-L79
Would be good to also output the attributes
attached to a PubSubMessage to msg.attributes
or similar.
Something like this (Note, I have never developed any Node-RED nodes though).
const msg = {
payload: message.data,
attributes: message.attributes
};
Made this small change locally and it works.
Thank you for the issue. This sounds great!!! I'm out of town this week but come the weekend, I'll affect the change and update the project. I'm delighted to accomodate feedback from users like yourself and appreciate you letting me know your needs and desires.
Neil
Seems I made a mess of this. Checking my own documentation, the intent was that the message propagated from PubSub-In was supposed to have a msg.message
object which contains the original published message as a whole. From this, one could then access the properties msg.message.attributes
to get the attributes. This was simply missing and I am at a loss to understand why. I have now added that logic and pushed the changes. I'll leave this issue open until I hear back from you that this is sufficient. We should now be able to access attributes at msg.message.attributes
.
Thanks for the quick response and action 👍
The change looks good to me, now we can access all the original information.
Thank you my friend. Am closing out this issue but feel free to add new ones as needed. I'll be here :-)