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

SSE htmx example #435

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

SSE htmx example #435

wants to merge 9 commits into from

Conversation

m110
Copy link
Member

@m110 m110 commented Apr 21, 2024

No description provided.

return nil
})

router, err := message.NewRouter(message.RouterConfig{}, logger)
Copy link
Member

Choose a reason for hiding this comment

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

it may be good to rename reouter to watermillRouter or something to not mess it with http

return nil, err
}

err = storage.UpdatePost(context.Background(), event.PostID, func(post *Post) {
Copy link
Member

Choose a reason for hiding this comment

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

don't you want to use ctx from msg?

publisher,
func(msg *message.Message) ([]*message.Message, error) {
var event PostReactionAdded
err := json.Unmarshal(msg.Payload, &event)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it wouldn't be worth to use cqrs here?

return buffer.String(), nil
}

type Storage struct {
Copy link
Member

Choose a reason for hiding this comment

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

what about naming it repository?

subscriber, err := googlecloud.NewSubscriber(googlecloud.SubscriberConfig{
ProjectID: cfg.PubSubProjectID,
GenerateSubscriptionName: func(topic string) string {
return fmt.Sprintf("%v_%v", topic, watermill.NewShortUUID())
Copy link
Member

Choose a reason for hiding this comment

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

maybe some comment will be useful here, why we are using shortuuid etc.?

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.

None yet

2 participants