

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 7
click for more info
Not enough gems
Cost: 6 gems
1: Exchanges and Queues
incomplete
2: Types of Exchanges
incomplete
3: Create a Queue
incomplete
4: Transient Queues
incomplete
5: Decoupling
incomplete
6: Client REPL
incomplete
7: Sync vs. Async
incomplete
8: Topic Exchange
incomplete
9: Durable
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Let's update our code to automatically create and delete transient queues, rather than doing it manually. We'll create the queues that the client will use to receive the "pause" messages from the server.
Durable queues survive a RabbitMQ server restart, while transient queues do not. We can also set the auto-delete and exclusive properties of our queues:
Exclusive: The queue can only be used by the connection that created it.
Auto-delete: The queue will be automatically deleted when its last consumer unsubscribes or disconnects.
For simplicity of our game, we'll make our transient and durable queues always have the same properties:
"Durable" queues in our system will always be non-exclusive and non-auto-delete.
"Transient" queues will always be exclusive and auto-delete.
func DeclareAndBind(
conn *amqp.Connection,
exchange,
queueName,
key string,
queueType SimpleQueueType, // SimpleQueueType is an "enum" type I made to represent "durable" or "transient"
) (*amqp.Channel, amqp.Queue, error)Run and submit the CLI tests with the client still open.