You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Publishing to a topic has no checks for whether the event can be unmarshalled (eg missing value for field)
When subscriptions try consuming the event is when the errors start appearing
This is more of a publishing error not a subscription error so we should try to surface this at the time of publication
Steps to repro
Write the following code:
//ftl:datatypeEventstruct {
Idstring`json:"id"`Namestring`json:"name,omitempty"`
}
varTopic= ftl.Topic[Event]("topic")
var_=ftl.Subscription(Topic, "sub")
//ftl:verbfuncPublish(ctx context.Context) error {
err:=Topic.Publish(ctx, Event{
Id: "abc",
})
// err should be set because the event is not valid, but it is nilreturnerr
}
//ftl:subscribe sub//ftl:retry 3 5s 30sfuncProcessEvent(ctx context.Context, eventEvent) error {
// never reachedreturnnil
}
When Publish() is called, FTL creates the event but fails each time it tries to consume it.
So for one published event, we get all 4 attempts logged like this:
warn:sub:example.sub:example.processEvent: Async call could not be called: could not validate HTTP request body: example.Event.name is required
warn:sub:example.sub:example.processEvent: Async call could not be called: could not validate HTTP request body: example.Event.name is required
warn:sub:example.sub:example.processEvent: Async call could not be called: could not validate HTTP request body: example.Event.name is required
warn:sub:example.sub:example.processEvent: Async call could not be called: could not validate HTTP request body: example.Event.name is required
The text was updated successfully, but these errors were encountered:
Steps to repro
Write the following code:
When
Publish()
is called, FTL creates the event but fails each time it tries to consume it.So for one published event, we get all 4 attempts logged like this:
The text was updated successfully, but these errors were encountered: