RabbitMQ by Example Flashcards

1
Q

What is RabbitMQ?

A

It is a open-source messaging queue system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What protocol does RabbitMQ is based on?

A

AMQP protocol - which stands for advanced message queue protocol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the main features of RabbitMQ?

A

Reliability: messages can be persisted and even the server can be restarted. Also supports message delivery acknowledgement to ensure the message was received.
Routing: Uses exchanges to route the messages to the proper queues.
Clustering and High Availability: Many instances of rabbit MQ can act as one, which tolerate failures without loosing messages.
Management Web Interface: Default UI that comes with the rabbitMQ server.
Command line tool: Called RabbitMQ ctrl and admin - offer the same level of configuration as the web interface but here you can do scripting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which languages have the rabbitMQ clients?

A

Pretty much all of them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is AMQP?

A

Network protocol that enables applications to exchange messages to other clients via a server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is MSMQ?

A

MSMQ was availablr to developers on 1997. ensure successful message delivery by placing failed messages on different queues. Also supports transactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between rabbitmq and MSMQ?

A
centralized and descentralized;
multi platform vs windows only;
standard based (AMQP) vs no standards;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which language was rabbitmq written on?

A

Erlang.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are some common functions of RabbitMQ?

A

Declare, list and delete rmq entities;
Queue and exchange monitoring;
Send and receive messages;
Monitor Erlang processes, file descriptors and memory use;
Force close connections, and purge queues.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a binding?

A

It is the connection between the queue and the exchange.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Where is the actual message stored?

A

In the Payload.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the requeue concept?

A

When true it means that you’ll read the message and leave it in the queue, otherwise remove from the queue (similar to pm_pmnoremove)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the common path a messages goes through until it gets to a consumer?

A

Publisher -> exchange -> routes -> Queue -> Consumer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens when a message can’t get to a consumer? Is it configurable?

A

it is configurable, can be returned to the sender, dropped or placed on a different queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a routing key?

A

Acts like a filter. It is a another way to filter further a message inside a queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the different types of exchanges?

A

Direct exchanges: Based on message routing key;
Fanout exchanges: Post the message to all queues that are connected to it (a copy of the message is posted on all queues).
Topic Exchanges: Wild cards on routing key to be able to post the same message on different queues (which also might have wildcards).
Header Exchanges: Routing key is ignored and the header will contain the routing keys (might have many) which are customized (e.g: material = wood).

17
Q

What is an exchange? What does it do? What does it use to route stuff?

A

Exchanges are message routing agents, defined by the virtual host within RabbitMQ. An exchange is responsible for routing the messages to different queues with the help of header attributes, bindings, and routing keys. Take a message and route to one or more queues.

18
Q

What are the four attributes of an exchange?

A

Name: Name of the exchange;
Durability: Persisting the message to disk;
Auto-delete: Delete message when not needed
Arguments: These are message broker-dependent

19
Q

When the fanout exchange is ideal?

A

For broadcasts. E.g: sending a chat message to a group of people.

20
Q

What is a queue? Does it work in a li-fo mode?

A

Queue is where the messages are posted. Works in a first in first out basis.

21
Q

What are the additional properties the queues provides in extra to the exchange?

A

Name: name of the queue;
Durable: Persisting the queue to disk;
Exclusive: Exclusive to one connection. Delete queue when not needed;
Auto Delete: Queue deleted when consumer unsubscribes.

22
Q

What is the durable concept means in RabitMQ

A

Means it will survive if the server goes down.

23
Q

What happens when a queue is declared? What happens if it already exists?

A

The queue is created. When already created nothing happens.

24
Q

Do I need to define a queue name?

A

No… the broker can generate it automatically.

25
Q

What is the max length of a queue name?

A

255 characters.

26
Q

What happens when a message is published to a queue that does not exist?

A

Depends… might be returned to the sender.

27
Q

Can I have more than one subscriber to a queue? When is it used?

A

Yes. It is common when you want to scale your application out once one of the free consumers might get the message to do some processing.

28
Q

When a message is removed from the queue?

A

When the consumer receives the message or when the consumer receives the message AND acknowledges to the queue

29
Q

What happens when an application receives the message but fails to process it?

A

The message can be discarded or re-queued. The consumer decides.

30
Q

Where are the core client classes located in the .net rabbitmq client lib?

A

RabbitMQ.Client namespace.

31
Q

What are the common interfaces of .net rabbitmq client lib?

A

IModel: most AMQP operations;
IConnection: an AMQP connection;
ConnectionFactory: Creates IConstructor;
ConnectionParameters and QueueingBasicConsumer;

32
Q

What is necessary to connect to a RabbitMQ using .net rabbitmq client lib?

A

HostName, Username and password (default guest).

33
Q

How to create a channel to RabbitMQ using .net rabbitmq client lib?

A

by calling connection.CreateModel();

34
Q

What is necessary to be done before using the exchanges and queues when using .net rabbitmq client lib?

A
It is necessary to declare them (if the object does not exists, then it is created):
var channel = connection.CreateModel();
channel.ExchangeDeclare;
channel.QueueDeclare;
channel.QueueBind("myQ", "MyExchange", "");
35
Q

When the messages can be send when using .net rabbitmq client lib?

A

after the queue is bound.

36
Q

What is necessary to do to post an object to the queue when using .net rabbitmq client lib?

A

It is necessary to data annotate the object as [Serializable] in order to convert to byte array and then post in the queue.

37
Q

What to use to serialize objects when using .net rabbitmq client lib? Do we need a specific lib?

A

ObjectSerializer, can be found in the newtonsoft.json lib.

38
Q

How does a serialized object look like?

A

Like a json string which is then converted to bytearray.

39
Q

What happens when no exchange is defined in RabbitMQ when using .net rabbitmq client lib?

A

The message is posted to the default exchange.