generated from nlnwa/go_container
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heavily inspired by the verify reject command this command now prints the messages from confirm-topic.
- Loading branch information
Showing
3 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
package confirmImplmentation | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/segmentio/kafka-go" | ||
"hermetic/internal/dps" | ||
) | ||
|
||
func Verify(confirmTopicName string) error { | ||
fmt.Printf("Reading messages from topic '%s'\n", confirmTopicName) | ||
fmt.Printf("This command is not implemented yet\n" + | ||
"Aims to solve issue https://github.com/nlnwa/hermetic/issues/3 ") | ||
func ReadConfirmTopic(ctx context.Context, reader *kafka.Reader) error { | ||
err := dps.ReadMessages(ctx, reader, ProcessMessagesFromConfirmTopic) | ||
if err != nil { | ||
return fmt.Errorf("failed to read confirm-topic: `%w`", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func ProcessMessagesFromConfirmTopic(response *dps.KafkaResponse, err error) { | ||
if err != nil { | ||
fmt.Errorf("failed to read message, cause: `%w`", err) | ||
} | ||
if response == nil { | ||
fmt.Println("No response found") | ||
} else { | ||
fmt.Printf("SIP successfully perserved: %+v\n", response) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.