encoredev / encore

Development Platform for building robust type-safe distributed systems with declarative infrastructure

Home Page:https://encore.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: PubSub subscription declared in service subpackage doesn't fire handler

pksieminski opened this issue · comments

Moving PubSub subscription declaration to service subpackage results in handler not being fired when new messages are published to the topic.

Considering the following payment service structure:

payment
├── event
│  └── event.go
└── pubsub.go

With event.go in event subpackage, declaring the subscription:

var _ = pubsub.NewSubscription(
	event.Orders, "payment-orders-sub",
	pubsub.SubscriptionConfig[*event.OrderEvent]{
		Handler: payment.OrderEventHandler,
	},
)

The payment.OrderEventHandler is not fired, but if subscription is moved back to pubsub.go in payment package, it works properly.