openinfraday/oslo.messaging - How it wor...

1.7 KiB

Messaging in Openstack

oslo_messaging

In PCI infra, oslo_messaging is configured using:

  • rabbitmq driver for RPC server/agent communication
  • kafka and log driver for notifications (send events to third party app)

RPC implementation in rabbitmq

RPC in openstack is implemented using oslo_messaging library.

!!! note "tldr"

- rpc call()
    - blocking call to invoke a method on a topic with 1 reply expected
- rpc cast()
    - invoke a method on a topic in 'best effort' mode without reply. If fanout=true message, is broadcasted to all topic consumers

In rabbitmq, a message is published to a queue using an exchange/routing_key. Consumers are directly connected to a queue to read messages from.

A oslo.messaging 'topic' is almost equivalent to a rabbitmq queue.

With a rpc call, message will be sent to rabbitmq through exchange=target.exchange queue={target.topic}.{target.server} Response will be sent back to caller using exchange=target.exchange queue={message.reply_queue}

With a rpc cast fanout=false, it's the same but there is no reply mechanism

With a rpc cast fanout=true, message will be sent to rabbitmq through exchange=target.exchange queue={target.topic}_fanout

For rpc call and rpc cast (fanout=false), we are using quorum queues (1 publisher / 1 consumer). For rpc cast (fanout=true), stream queues are used because it's purpose is to broadcast messages (1 publisher / N consumers).

On startup, every server/agent declare queues they will consume from. If queue does not exist on rabbit cluster, it is created. It's the same for publishing part with the exchange.