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

Implement Queues Consumer #137

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Implement Queues Consumer #137

merged 1 commit into from
Jan 15, 2025

Conversation

meandnano
Copy link
Contributor

What

This adds support for Queues consumer.

Motivation

#53

@syumai
Copy link
Owner

syumai commented Dec 2, 2024

I'll check this PR in this week, I'm sorry for being late.

@syumai
Copy link
Owner

syumai commented Jan 15, 2025

I'm sorry for being late. LGTM, thanks!

@syumai syumai merged commit 0c1f74c into syumai:main Jan 15, 2025
2 checks passed
Comment on lines +84 to +98
func (m *ConsumerMessage) IntBody() (int, error) {
if m.Body.Type() == js.TypeNumber {
return m.Body.Int(), nil
}

return 0, fmt.Errorf("message body is not a number: %v", m.Body)
}

func (m *ConsumerMessage) FloatBody() (float64, error) {
if m.Body.Type() == js.TypeNumber {
return m.Body.Float(), nil
}

return 0, fmt.Errorf("message body is not a number: %v", m.Body)
}
Copy link
Owner

Choose a reason for hiding this comment

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

These methods seem to be just wrappers around js.Value.
Since we can also use Body directly, I'll omit these methods and leave only StringBody and BytesBody. (StringBody is also just a wrapper, but I'll keep it because I think it will be used often.)

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