/otus-rabbit

Пример кода для открытого урока

Primary LanguageC#

OtusRabbit

RabbitMQ. Взаимодействие с очередями

Отправка сообщения в пустой Exchange

{
  "exchange": "",
  "routingKey": "hello",
  "body": "Message to empty exchange with routing key"
}
{
  "exchange": "",
  "routingKey": "task_queue",
  "body": "Message for multiple consumers"
}

Подписка на Exchange с временными очередями

{
  "exchange": "logs",
  "routingKey": "",
  "body": "Log message"
}

Подписка на Exchange с роутингом

{
  "exchange": "direct_logs",
  "routingKey": "info",
  "body": "Information message"
}
{
  "exchange": "direct_logs",
  "routingKey": "error",
  "body": "Error message"
}

Подписка на Exchange с роутингом по топикам

{
  "exchange": "topic_logs",
  "routingKey": "api.error",
  "body": "Error form api"
}
{
  "exchange": "topic_logs",
  "routingKey": "api.info",
  "body": "Information message from api"
}
{
  "exchange": "topic_logs",
  "routingKey": "client.any",
  "body": "Just a message"
}

Отправка с ожиданием ответа

{
  "body": "This.is.a.message.with.multiple.dots"
}

MassTransit

{
  "from": "Me",
  "to": "Friend",
  "message": "Hello darkness, my old friend I've come to talk with you again"
}