func listenForLocalSQSEvents(urls []string) {
ctx := context.Background()
sess := session.Must(session.NewSessionWithOptions(session.Options{
Config: aws.Config{
CredentialsChainVerboseErrors: aws.Bool(true),
Endpoint: aws.String(env.GetString("ELASTICMQ_URI")),
Region: aws.String("ELASTICMQ_REGION"),
},
}))
svc := sqs.New(sess)
for _, url := range urls {
go func(url string) {
for {
log.Printf("requesting at: %v", time.Now())
msgResult, err := svc.ReceiveMessage(&sqs.ReceiveMessageInput{
AttributeNames: []*string{
aws.String(sqs.MessageSystemAttributeNameSentTimestamp),
},
MessageAttributeNames: []*string{
aws.String(sqs.QueueAttributeNameAll),
},
QueueUrl: aws.String(url),
MaxNumberOfMessages: aws.Int64(10),
WaitTimeSeconds: aws.Int64(5),
})
if err != nil {
panic(err)
}
log.Printf("msgResult: %+v", msgResult.String())
if err := eventsLambda.Consume(ctx, msgResult); err != nil {
log.Printf("local sqs consumer error: %v", err)
continue
}
}
}(v)
}
}
The problem is, some messages are never delivered and some are delivered with no delay at all.
Using the UI I noticed that the messages which are never delivered increase the counter on the Approximate number of not visible Messages column.
Hi!
I'm using elasticmq with Go and currently this is my pooling implementation:
The problem is, some messages are never delivered and some are delivered with no delay at all.
Using the UI I noticed that the messages which are never delivered increase the counter on the Approximate number of not visible Messages column.