-
Notifications
You must be signed in to change notification settings - Fork 358
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
base: master
Are you sure you want to change the base?
SSE htmx example #435
Conversation
return nil | ||
}) | ||
|
||
router, err := message.NewRouter(message.RouterConfig{}, logger) |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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.?
No description provided.