pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
747 stars 144 forks source link

Help with Get operation #324

Closed Ankurkh1 closed 6 years ago

Ankurkh1 commented 6 years ago

First of all let me thank you for this awesome library :) Now, I am trying to use get operation and create batches of messages based on a size. Is there a way to read message size after get? Is there a way to set context and access pipecontext properties like how it is available for subscribe operation?

Any help will be highly appreciated.

pardahlman commented 6 years ago

Top of the morning, @Ankurkh1 ☕️

Is there a way to read message size after get? Do you refer to the number of message is the queue or the byte size of each message?

The AMQP protocol does not have any method for reading queue size. I would recommend using Management plugin's RESTful API for this.

Is there a way to set context and access pipecontext properties like how it is available for subscribe operation?

Unfortunately not today; the method returns Ackable. However, note that the pipe definitions are public and static, so you should be able to create your own operation that is based on the pipes (in fact you can even create your modified pipe based on the original pipe like we do for message context).

pardahlman commented 6 years ago

I just realized that you could use the MessageCount method on the channel to get hold of the queue length:

var channel = await client.CreateChannelAsync();
channel.MessageCount(queueName)

I don't have any plans to Incorporate this in the Get methods, but it shouldn't be that difficult to to extend the execution pipe on your own.