diff --git a/cmd/balance-worker/main.go b/cmd/balance-worker/main.go index efcd6afb3..df0c6c6c2 100644 --- a/cmd/balance-worker/main.go +++ b/cmd/balance-worker/main.go @@ -55,7 +55,7 @@ import ( const ( defaultShutdownTimeout = 5 * time.Second - otelName = "openmeter.io/backend" + otelName = "openmeter.io/balance-worker" ) func main() { diff --git a/cmd/notification-service/main.go b/cmd/notification-service/main.go index 81b25bd01..21d6f0598 100644 --- a/cmd/notification-service/main.go +++ b/cmd/notification-service/main.go @@ -55,7 +55,7 @@ import ( const ( defaultShutdownTimeout = 5 * time.Second - otelName = "openmeter.io/backend" + otelName = "openmeter.io/notification-service" ) func main() { diff --git a/openmeter/entitlement/balanceworker/worker.go b/openmeter/entitlement/balanceworker/worker.go new file mode 100644 index 000000000..33c90519c --- /dev/null +++ b/openmeter/entitlement/balanceworker/worker.go @@ -0,0 +1,13 @@ +package balanceworker + +import "github.com/openmeterio/openmeter/internal/entitlement/balanceworker" + +type ( + Worker = balanceworker.Worker + WorkerOptions = balanceworker.WorkerOptions + WorkerDLQOptions = balanceworker.WorkerDLQOptions +) + +func New(opts WorkerOptions) (*Worker, error) { + return balanceworker.New(opts) +} diff --git a/openmeter/event/publisher/publisher.go b/openmeter/event/publisher/publisher.go index ddf243c4f..c5aec9318 100644 --- a/openmeter/event/publisher/publisher.go +++ b/openmeter/event/publisher/publisher.go @@ -3,11 +3,20 @@ package publisher import "github.com/openmeterio/openmeter/internal/event/publisher" type ( - Publisher = publisher.Publisher - PublisherOptions = publisher.PublisherOptions - TopicPublisher = publisher.TopicPublisher + Publisher = publisher.Publisher + PublisherOptions = publisher.PublisherOptions + TopicPublisher = publisher.TopicPublisher + CloudEventMarshaler = publisher.CloudEventMarshaler +) + +type ( + TransformFunc = publisher.TransformFunc ) func NewPublisher(options PublisherOptions) (Publisher, error) { return publisher.NewPublisher(options) } + +func NewCloudEventMarshaler(transform TransformFunc) CloudEventMarshaler { + return publisher.NewCloudEventMarshaler(transform) +} diff --git a/openmeter/notification/consumer/consumer.go b/openmeter/notification/consumer/consumer.go new file mode 100644 index 000000000..75c254ece --- /dev/null +++ b/openmeter/notification/consumer/consumer.go @@ -0,0 +1,13 @@ +package consumer + +import "github.com/openmeterio/openmeter/internal/notification/consumer" + +type ( + Options = consumer.Options + DLQOptions = consumer.DLQOptions + Consumer = consumer.Consumer +) + +func New(opts Options) (*Consumer, error) { + return consumer.New(opts) +} diff --git a/openmeter/registry/entitlement.go b/openmeter/registry/entitlement.go new file mode 100644 index 000000000..4c879799d --- /dev/null +++ b/openmeter/registry/entitlement.go @@ -0,0 +1,12 @@ +package registry + +import "github.com/openmeterio/openmeter/internal/registry" + +type ( + Entitlement = registry.Entitlement + EntitlementOptions = registry.EntitlementOptions +) + +func GetEntitlementRegistry(opts EntitlementOptions) *Entitlement { + return registry.GetEntitlementRegistry(opts) +}