looplab / eventhorizon

Event Sourcing for Go!
Apache License 2.0
1.57k stars 196 forks source link

Add option to provide pubsub configuration for topic #382

Closed marcwickenden closed 2 years ago

marcwickenden commented 2 years ago

Description

Provides the ability to configure the creation of the GCP PubSub topic. Specifically I wanted to be able to specify message retention. This paves the way for replaying messages to enable projections to resync.

Affected Components

Related Issues

Nothing specific but begins to address projection errors. Only for GCP though.

Solution and Design

The pubsub client also has a CreateTopicWithConfig function which takes an additional argument of a TopicConfig struct. By adding an additional function to the gcp eventbus package (WithTopicOptions, copypasta of WithPubSubOptions but updates different struct property) we can supply a TopicConfig struct as an option to NewEventBus().

Steps to test and verify

  1. Run TestEventBusWithConfigIntegration test in eventbus_test.go.
coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.02%) to 68.831% when pulling 9b8a8fd295d7ce913596c5b8c35a6fed11ee0820 on marcwickenden:main into 1a724818998425e1b7a84932cfa378c92c504c7d on looplab:main.