0
0
RabbitMQdevops~10 mins

RabbitMQ vs Kafka comparison - Interactive Practice

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

Complete the code to declare a RabbitMQ queue named 'task_queue'.

RabbitMQ
channel.queue_declare(queue='[1]')
Drag options to blanks, or click blank then click option'
Arouting_key
Bexchange
Ctopic
Dtask_queue
Attempts:
3 left
💡 Hint
Common Mistakes
Using exchange or routing_key instead of queue name.
2fill in blank
medium

Complete the code to publish a message to a Kafka topic named 'logs'.

RabbitMQ
producer.send('[1]', value=b'Hello Kafka')
Drag options to blanks, or click blank then click option'
Alogs
Bqueue
Cexchange
Drouting_key
Attempts:
3 left
💡 Hint
Common Mistakes
Using RabbitMQ terms like queue or exchange in Kafka code.
3fill in blank
hard

Fix the error in the RabbitMQ consumer code to acknowledge messages manually.

RabbitMQ
channel.basic_consume(queue='task_queue', on_message_callback=callback, auto_ack=[1])
Drag options to blanks, or click blank then click option'
AFalse
BNone
CTrue
Dauto
Attempts:
3 left
💡 Hint
Common Mistakes
Setting auto_ack to True disables manual acknowledgments.
4fill in blank
hard

Fill both blanks to create a Kafka consumer that subscribes to 'metrics' and starts polling.

RabbitMQ
consumer = KafkaConsumer('[1]')
message = consumer.[2]()
Drag options to blanks, or click blank then click option'
Ametrics
Bpoll
Csubscribe
Dconsume
Attempts:
3 left
💡 Hint
Common Mistakes
Using subscribe() method incorrectly or wrong topic name.
5fill in blank
hard

Fill all three blanks to create a RabbitMQ message publisher with exchange type 'direct' and routing key 'info'.

RabbitMQ
channel.exchange_declare(exchange='[1]', exchange_type='[2]')
channel.basic_publish(exchange='[1]', routing_key='[3]', body='Hello World')
Drag options to blanks, or click blank then click option'
Alogs
Bdirect
Cinfo
Dtopic
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong exchange type or mismatched routing key.