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

accept non-promise callbacks #5

Merged
merged 1 commit into from
Apr 23, 2017
Merged

accept non-promise callbacks #5

merged 1 commit into from
Apr 23, 2017

Conversation

johndagostino
Copy link
Contributor

Description

accept non-promise callbacks

Describe the overall goal(s) of the pull request's commits.


Changes

List the main changes in this PR.


Testing Instructions

Outline the steps to test or reproduce the PR.


Screenshots

(if appropriate, they help the reviewer visualise the changes)


@@ -7,7 +7,7 @@ function Task(
producer: Producer,
topic: string,
subscribeCallback: Callback) {
const subscribe = (payload: any) => subscribeCallback(payload);
const subscribe = (payload: any) => Promise.resolve(subscribeCallback(payload));
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check like this?

src/runner.js Outdated
const task = registry.getTask(topic);
await task.subscribe(JSON.parse(m.message.value.toString('utf8'))); // eslint-disable-line
await consumer.commitOffset({ topic, partition, offset: m.offset, metadata: 'optional' }); // eslint-disable-line
Copy link
Contributor

Choose a reason for hiding this comment

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

if subscribe throws error, commit won't execute.. Is it ok? 🤔

@johndagostino johndagostino merged commit ff66d9c into master Apr 23, 2017
@johndagostino johndagostino deleted the feature/callback branch April 23, 2017 22:54
zcapper added a commit that referenced this pull request Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants