Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[component/functions|component/go] Add access to the current message from the function context #8290

Conversation

vaihtovirta
Copy link
Contributor

@vaihtovirta vaihtovirta commented Oct 18, 2020

Motivation

It may be helpful to access the current message in order to access its metadata (key, properties, etc).

Modifications

  • Implemented FunctionContext#GetCurrentRecord (similar to Context#getCurrentRecord)
  • Implemented FunctionContext#SetCurrentRecord
  • Set current message before executing a message handler in goInstance#handleMsg

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Added unit tests for FunctionContext#GetCurrentRecord
  • Added unit tests for FunctionContext#SetCurrentRecord
  • Added unit tests for goInstance#handlerMsg

Does this pull request potentially affect one of the following parts:

  • The public API: (yes)
  • The default values of configurations: (yes)

Documentation

  • Does this pull request introduce a new feature? (yes )
  • If yes, how is the feature documented? (docs)

@vaihtovirta vaihtovirta force-pushed the feat/pulsar-function-go/add-access-to-current-message branch from 485f726 to 4eeb76e Compare October 19, 2020 20:16
@sijie sijie added this to the 2.7.0 milestone Oct 21, 2020
@sijie sijie added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. doc-required Your PR changes impact docs and you will update later. labels Oct 21, 2020
@sijie sijie requested a review from wolfstudy October 21, 2020 05:51
Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@wolfstudy wolfstudy merged commit 7462324 into apache:master Oct 21, 2020
@vaihtovirta vaihtovirta deleted the feat/pulsar-function-go/add-access-to-current-message branch October 21, 2020 07:17
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Nov 13, 2020
…from the function context (apache#8290)

### Motivation

It may be helpful to access the current message in order to access its metadata (key, properties, etc).

### Modifications

- Implemented `FunctionContext#GetCurrentRecord` (similar to [Context#getCurrentRecord](https://github.com/apache/pulsar/blob/9c821cf940d422d2ea3d47687bd309fe698ab84e/pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/Context.java#L46))
- Implemented `FunctionContext#SetCurrentRecord`
- Set current message before executing a message handler in `goInstance#handleMsg`

### Verifying this change

- [x] Make sure that the change passes the CI checks.
flowchartsman pushed a commit to flowchartsman/pulsar that referenced this pull request Nov 17, 2020
…from the function context (apache#8290)

### Motivation

It may be helpful to access the current message in order to access its metadata (key, properties, etc).

### Modifications

- Implemented `FunctionContext#GetCurrentRecord` (similar to [Context#getCurrentRecord](https://github.com/apache/pulsar/blob/9c821cf940d422d2ea3d47687bd309fe698ab84e/pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/Context.java#L46))
- Implemented `FunctionContext#SetCurrentRecord`
- Set current message before executing a message handler in `goInstance#handleMsg`

### Verifying this change

- [x] Make sure that the change passes the CI checks.
@momo-jun
Copy link
Contributor

Checked with @freeznet - This PR already contains the required doc changes. The doc label needs a refresh.
//cc @Anonymitaet

@Anonymitaet Anonymitaet removed the doc-required Your PR changes impact docs and you will update later. label Jul 20, 2022
@Anonymitaet
Copy link
Member

@momo-jun thanks, then I've unchecked the doc-required label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/function doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants