This file contains hidden or 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
| func (t *TestContainerWrapper) RunContainer() error { | |
| req := testcontainers.ContainerRequest{ | |
| Image: fmt.Sprintf("%s:%s", RedpandaImage, RedpandaVersion), | |
| ExposedPorts: []string{ | |
| "9092:9092/tcp", | |
| }, | |
| Cmd: []string{"redpanda", "start"}, | |
| WaitingFor: wait.ForLog("Successfully started Redpanda!"), | |
| AutoRemove: true, | |
| } |
This file contains hidden or 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
| type TestContainerWrapper struct { | |
| container testcontainers.Container | |
| hostPort int | |
| } | |
| type IntegrationTestSuite struct { | |
| suite.Suite | |
| wrapper TestContainerWrapper | |
| } |
This file contains hidden or 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
| consumer: | |
| groupId: "exception-consumer" | |
| topic: "exception" | |
| maxRetry: 3 | |
| concurrency: 1 | |
| cron: "*/20 * * * *" | |
| duration: 15m |
This file contains hidden or 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
| func main() { | |
| // .. | |
| var consumeFn kafka.ConsumeFn = func(message kafka.Message) error { | |
| fmt.Printf("consumer > Message received: %s\n", string(message.Value)) | |
| return nil | |
| } | |
| c := cronsumer.New(kafkaConfig, consumeFn) | |
| c.Run() | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "net/http/httputil" | |
| "net/url" | |
| "sync/atomic" | |
| ) | |
| type Backend struct { |
This file contains hidden or 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
| type Registrar struct { | |
| DockerClient *DockerClient | |
| SRegistry *ServiceRegistry | |
| } | |
| func (r *Registrar) Init() error { | |
| cList, err := r.DockerClient.ContainerList(context.Background(), types.ContainerListOptions{ | |
| Filters: filters.NewArgs( | |
| filters.Arg("ancestor", HelloServiceImageName), | |
| filters.Arg("status", ContainerRunningState), |
This file contains hidden or 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
| package main | |
| import ( | |
| "log" | |
| "time" | |
| "github.com/Abdulsametileri/package-tracking-app/domain" | |
| _packageClient "github.com/Abdulsametileri/package-tracking-app/package/client" | |
| _packageHttpDelivery "github.com/Abdulsametileri/package-tracking-app/package/delivery/http" | |
| _packageUcase "github.com/Abdulsametileri/package-tracking-app/package/usecase" |
This file contains hidden or 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
| func (p *packageUsecase) TrackByVehicleID(ctx context.Context, id string) (*domain.Package, error) { | |
| bytes, err := p.pc.ConsumeByVehicleID(ctx, id) | |
| if err != nil { | |
| return nil, err | |
| } | |
| var res domain.Package | |
| err = json.Unmarshal(bytes, &res) | |
| return &res, err | |
| } |
This file contains hidden or 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
| package client | |
| import ( | |
| "context" | |
| "errors" | |
| "fmt" | |
| "github.com/Abdulsametileri/package-tracking-app/domain" | |
| amqp "github.com/rabbitmq/amqp091-go" | |
| ) |
This file contains hidden or 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
| func (p *PackageHandler) TrackByVehicleID(c echo.Context) error { | |
| wsConn, err := p.upgrader.Upgrade(c.Response(), c.Request(), nil) | |
| if err != nil { | |
| return err | |
| } | |
| ctx, cancelFunc := context.WithCancel(context.Background()) | |
| go func() { | |
| _, _, err = wsConn.ReadMessage() |