Created
November 15, 2013 14:49
-
-
Save mikehadlow/7485471 to your computer and use it in GitHub Desktop.
EasyNetQ's proposed new send/receive API. This is for sending messages explicitly to a named destination queue via the default exchange. The Receive call creates a consumer for the specified message type. Further calls to Receive with the same queue, but a different message type will add additional message handlers to the same consumer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Send a message directly to a queue | |
/// </summary> | |
/// <typeparam name="T">The type of message to send</typeparam> | |
/// <param name="queue">The queue to send to</param> | |
/// <param name="message">The message</param> | |
void Send<T>(string queue, T message); | |
/// <summary> | |
/// Receive messages from a queue. | |
/// Multiple calls to Receive for the same queue, but with different message types | |
/// will add multiple message handlers to the same consumer. | |
/// </summary> | |
/// <typeparam name="T">The type of message to receive</typeparam> | |
/// <param name="queue">The queue to receive from</param> | |
/// <param name="onMessage">The message handler</param> | |
void Receive<T>(string queue, Action<T> onMessage); | |
/// <summary> | |
/// Receive messages from a queue. | |
/// Multiple calls to Receive for the same queue, but with different message types | |
/// will add multiple message handlers to the same consumer. | |
/// </summary> | |
/// <typeparam name="T">The type of message to receive</typeparam> | |
/// <param name="queue">The queue to receive from</param> | |
/// <param name="onMessage">The asychronous message handler</param> | |
void Receive<T>(string queue, Func<T, Task> onMessage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's fine, I think it's robust enough, and it can be a good enhancement. thanks!