softwaremill / softwaremill/elasticmq

Redrive Policy Example

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

Nobody has claimed this yet.

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

Description

Hi @adamw ,

If you have any samples to create redrivepolicy links using dead queues that would be great . Currently , I am trying to create a redrivepolicy during CreateQueueRequest (Amazon Java SDK) using queue attributes. I do get a debug point on the RedrivePolicy.class in the elasticmq package . But elasticmq doesnt seem to create a link with the DeadLetterQueue.

My java code :

final Map<String, String> deadLetterQueueAttrs = new HashMap<>();
deadLetterQueueAttrs.put("VisibilityTimeout", "600");
final CreateQueueRequest createDeadLetterQueueRequest = new CreateQueueRequest()
.withQueueName(queueName + "-error")
.withAttributes(deadLetterQueueAttrs);

	final CreateQueueResult deadLetterQueueResult = amazonSQSAsyncClient.createQueue(createDeadLetterQueueRequest);
	final GetQueueAttributesResult deadLetterQueueArnResult = amazonSQSAsyncClient.getQueueAttributes(deadLetterQueueResult.getQueueUrl(), Arrays.asList("QueueArn"));

	final Map<String, String> queueAttributes = new HashMap<>();
	final StringBuilder redrivePolicyParamBuilder = new StringBuilder()
		.append("{\"deadLetterTargetArn\" : \"")
		.append(deadLetterQueueArnResult.getAttributes().get("QueueArn"))
		.append("\",")
		.append("\"maxReceiveCount\": \"1\"}");
	queueAttributes.put("RedrivePolicy", redrivePolicyParamBuilder.toString());
	queueAttributes.put("VisibilityTimeout","600");

	final CreateQueueRequest createQueueRequest = new CreateQueueRequest()
		.withQueueName(queueName)
		.withAttributes(queueAttributes);

	final CreateQueueResult createQueueResult = amazonSQSAsyncClient.createQueue(createQueueRequest);

No errors are thrown but the redrive policy link is not created,

Kindly help.

Regards,
Harish

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

Start at RedrivePolicy.class and the CreateQueueRequest attribute handling described in the report, then reproduce the Java AWS SDK sequence that creates the dead-letter queue and the source queue. Confirm whether the RedrivePolicy link is stored and observable as expected, and add or update a focused test if the relevant test location can be identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java, scala
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.