Skip to content

Commit

Permalink
Expect two topics in response for order service
Browse files Browse the repository at this point in the history
  • Loading branch information
weeco committed Mar 28, 2021
1 parent 47be3f8 commit 8fb233c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/shop/order_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,19 @@ func (svc *OrderService) createKafkaTopic(ctx context.Context) error {
}

// Check for inner kafka errors
if len(res.Topics) != 1 {
return fmt.Errorf("unexpected topic response count from create topics request. Expected count '1', actual returned count: '%v'", len(res.Topics))
if len(res.Topics) != 2 {
return fmt.Errorf("unexpected topic response count from create topics request. Expected count '2', actual returned count: '%v'", len(res.Topics))
}

err = kerr.ErrorForCode(res.Topics[0].ErrorCode)
if err != nil {
return fmt.Errorf("create topics request failed. Inner kafka error: %w", err)
}

err = kerr.ErrorForCode(res.Topics[1].ErrorCode)
if err != nil {
return fmt.Errorf("create topics request failed. Inner kafka error: %w", err)
}

return nil
}

0 comments on commit 8fb233c

Please sign in to comment.