0
0
Spring Bootframework~10 mins

Dead letter queues in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a dead letter queue in Spring Boot.

Spring Boot
Queue deadLetterQueue() {
    return new Queue("[1]", true);
}
Drag options to blanks, or click blank then click option'
AmainQueue
BmyDeadLetterQueue
CprocessingQueue
DretryQueue
Attempts:
3 left
💡 Hint
Common Mistakes
Using the main queue name instead of a dead letter queue name.
Using a retry queue name which is different from dead letter queue.
2fill in blank
medium

Complete the code to bind the dead letter queue to the dead letter exchange.

Spring Boot
Binding deadLetterBinding(Queue deadLetterQueue, DirectExchange deadLetterExchange) {
    return BindingBuilder.bind(deadLetterQueue).to(deadLetterExchange).with("[1]");
}
Drag options to blanks, or click blank then click option'
AretryRoutingKey
BprocessingRoutingKey
CmainRoutingKey
DdeadLetterRoutingKey
Attempts:
3 left
💡 Hint
Common Mistakes
Using the main routing key instead of the dead letter routing key.
Using the retry routing key which is unrelated.
3fill in blank
hard

Fix the error in the queue declaration to enable dead letter exchange support.

Spring Boot
Map<String, Object> args = new HashMap<>();
args.put("[1]", "deadLetterExchange");
Queue queue = new Queue("mainQueue", true, false, false, args);
Drag options to blanks, or click blank then click option'
Ax-dead-letter-exchange
Bx-message-ttl
Cx-max-length
Dx-priority
Attempts:
3 left
💡 Hint
Common Mistakes
Using TTL or max length keys instead of dead letter exchange key.
Forgetting to set the dead letter exchange argument.
4fill in blank
hard

Fill both blanks to configure a queue with dead letter exchange and dead letter routing key.

Spring Boot
Map<String, Object> args = new HashMap<>();
args.put("[1]", "deadLetterExchange");
args.put("[2]", "deadLetterRoutingKey");
Queue queue = new Queue("mainQueue", true, false, false, args);
Drag options to blanks, or click blank then click option'
Ax-dead-letter-exchange
Bx-message-ttl
Cx-dead-letter-routing-key
Dx-max-length
Attempts:
3 left
💡 Hint
Common Mistakes
Using TTL or max length keys instead of dead letter keys.
Mixing up the routing key and exchange keys.
5fill in blank
hard

Fill all three blanks to create a dead letter queue, dead letter exchange, and bind them with a routing key.

Spring Boot
Queue deadLetterQueue() {
    return new Queue("[1]", true);
}

DirectExchange deadLetterExchange() {
    return new DirectExchange("[2]");
}

Binding deadLetterBinding() {
    return BindingBuilder.bind(deadLetterQueue()).to(deadLetterExchange()).with("[3]");
}
Drag options to blanks, or click blank then click option'
AmyDeadLetterQueue
BdeadLetterExchange
CdeadLetterRoutingKey
DmainQueue
Attempts:
3 left
💡 Hint
Common Mistakes
Using main queue or unrelated names for dead letter components.
Mismatching routing key and binding key.