Refactor application initialization to load configuration and enhance message processing. Introduce effective subscription topic handling and improve error management in NATS consumer. Update tests for publisher error handling and add new dependency injection method for app initialization.

This commit is contained in:
windyboy
2025-11-14 22:43:04 +08:00
parent 9cce4610b6
commit 02e54a2670
8 changed files with 196 additions and 35 deletions
+3 -3
View File
@@ -94,7 +94,7 @@ func TestHandleSuccessSetsUuidAndPublishes(t *testing.T) {
}
}
func TestHandlePublisherErrorIsRetriable(t *testing.T) {
func TestHandlePublisherErrorIsPermanent(t *testing.T) {
parsed := domain.NewParsedMessage()
parsed.Parsed = true
@@ -106,8 +106,8 @@ func TestHandlePublisherErrorIsRetriable(t *testing.T) {
if err == nil {
t.Fatalf("expected error when publisher fails")
}
if IsPermanent(err) {
t.Fatalf("publisher failure should not be permanent")
if !IsPermanent(err) {
t.Fatalf("publisher failure should be permanent")
}
if len(repo.inserted) != 1 {
t.Fatalf("expected message to insert before publish failure")