0
0
Microservicessystem_design~10 mins

Message brokers (Kafka, RabbitMQ) in Microservices - Interactive Code Practice

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

Complete the code to specify the message broker type in the configuration.

Microservices
config = {"broker": "[1]"}
Drag options to blanks, or click blank then click option'
AMySQL
BRedis
CPostgreSQL
DKafka
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a database instead of a message broker.
2fill in blank
medium

Complete the code to create a durable queue in RabbitMQ.

Microservices
channel.queue_declare(queue='task_queue', durable=[1])
Drag options to blanks, or click blank then click option'
A0
BFalse
CTrue
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using False which creates a non-durable queue.
3fill in blank
hard

Fix the error in the Kafka consumer group configuration.

Microservices
consumer = KafkaConsumer('my_topic', group_id='[1]')
Drag options to blanks, or click blank then click option'
Amy_group
B''
CNone
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using None or empty string as group_id.
4fill in blank
hard

Fill both blanks to configure a Kafka topic with 3 partitions and replication factor 2.

Microservices
topic_config = {'partitions': [1], 'replication_factor': [2]
Drag options to blanks, or click blank then click option'
A3
B1
C2
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up partitions and replication factor values.
5fill in blank
hard

Fill all three blanks to create a RabbitMQ exchange with type 'direct', durable true, and auto_delete false.

Microservices
channel.exchange_declare(exchange='logs', exchange_type='[1]', durable=[2], auto_delete=[3])
Drag options to blanks, or click blank then click option'
Afanout
Bdirect
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong exchange type or wrong boolean values.