You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/12/22 13:09:37 UTC

[GitHub] [pulsar] freeznet commented on issue #9022: Expose message metadata in Pulsar function Go

freeznet commented on issue #9022:
URL: https://github.com/apache/pulsar/issues/9022#issuecomment-749532247


   `Context` already holds the message metadata in golang function. you can check the Golang part of [context docs](http://pulsar.apache.org/docs/en/next/functions-develop/#context) here.
   
   As for your issue, the message can get from `FunctionContext.GetCurrentRecord()` (https://github.com/apache/pulsar/blob/master/pulsar-function-go/pf/context.go#L168), which will get `pulsar.Message` (https://github.com/apache/pulsar-client-go/blob/master/pulsar/message.go#L66) to access exposed message metadata like id, the key, the event time, etc.
   
   Also, here is an example function (https://github.com/apache/pulsar/blob/master/pulsar-function-go/examples/contextFunc/contextFunc.go) might be helpful as well.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org