Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

[BUG] EventBusRabbitMQ Message Processing Problem #888

Closed
@falamarzijahromi

Description

@falamarzijahromi

I'm examining RabbitMqEventBus functionality with some integration and functional tests for using it in a project. I found that according to RabbitMq.Client source code on the consumer, Received Event is an EventHandler<>, therefor the client library didn't handle for any asynchronous operations (Like Exception handling in async methods!).

///<summary>Event fired on HandleBasicDeliver.</summary>
public event EventHandler<BasicDeliverEventArgs> Received;

https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/master/projects/client/RabbitMQ.Client/src/client/events/EventingBasicConsumer.cs

But in EventBusRabbitMq, message consuming handled with an async subscription.

It will causes two problems:

  1. Processing messages non-sequentially:
    As EventBusRabbitMq uses async subscription for the Received Event, It will causes to dedicate a separate Thread for every message processing (Threads count will be limited to the client QoS config). In this case for example if messages M1, M2 were in the queue, both of them will be processed simultaneously. In the cases that choreography of events were important (Like when events related to a specific entity) this will causes a disaster.
    Beside everything, queued messages must really be processed sequentially. Receiving every types of messages in one queue for a microservice (That this kind of design is in question itself!) won't be the reason to process messages non-sequentially.

  2. Exception Handling problems:
    As RabbitMq.Client doesn't handle the Received Event asynchronously, any Exception throw during processing a message won't be caught, therefor causes application or test down. The subscribtion for CallbackException Event in the EventBusRabbitMqBus, won't be invoked in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions