We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Transient Queues

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 and Transient Queue Types

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 connection is closed.

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.

Assignment

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.