softwaremill / softwaremill/elasticmq

Messages randomly not delivered

Open
#738 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

awaiting-user-input
Dominant language
Scala
Stars
2.9k
Forks
203
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Hi!

I'm using elasticmq with Go and currently this is my pooling implementation:

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the issue with the supplied Go AWS SQS polling loop and inspect ElasticMQ's receive and visibility handling alongside the reported UI counter. Done means the cause of messages becoming not visible without delivery is identified and the behavior is covered by a focused regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.