Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,124 | Comments: 45,470

filter by tags archive

Raven MQ – The Real API

time to read 3 min | 589 words

Originally posted at 11/17/2010

This is now a passing test…

public class UntypedMessages : IDisposable
    private readonly RavenMqServer ravenMqServer;
    private readonly RavenConfiguration configuration;

    public UntypedMessages()
        configuration = new RavenConfiguration
            RunInMemory = true,
            AnonymousUserAccessMode = AnonymousUserAccessMode.All
        ravenMqServer = new RavenMqServer(configuration);

    public void Can_get_message_from_client_connection()
        using(var connection = new RavenMQConnection(
            new Uri(configuration.ServerUrl), 
            new IPEndPoint(IPAddress.Loopback, 8181)))
            var manualResetEventSlim = new ManualResetEventSlim(false);
            OutgoingMessage msg = null;
            connection.Subscribe("/queues/abc", (context, message) =>
                msg = message;


            ravenMqServer.Queues.Enqueue(new IncomingMessage
                Data = new byte[] {1, 2, 3},
                Queue = "/queues/abc"


            Assert.Equal(new byte[]{1,2,3}, msg.Data);

    private void WaitForSubscription()
        // not important

    public void Dispose()

Unlike the previous posts, which were more design and up front, this post shows working code. I am still not completely happy witht his, mostly because of the RavenMQConnection ctor parameters, but I can live with this for now.



RavenMQ is using RavenDB as underlying storage engine. Can I assume that messages are persisted in the document database when RunInMemory=false? As it is (and has roughly the same performance as rhino.queues) I have a ton of usages for it..

With a simple wrapper you can almost use it as an dropin for the Queue <t class. The wrapper can verify if the message is of type T.

Ayende Rahien


RavenMQ uses the same storage technology as RavenDB, not RavenDB.

But yes, it persists to disk.


Seems that you want to run your tests as fast as possible, using ManualResetEventSlim:> Does internals of RavenMQ use it as well?

Ayende Rahien


Actually, no. We don't do any locking inside RavenMQ


Ayende, thanks for that clarification. I know it's early, but do you have any timeline on a alpha release?


1) What is WaitForSubscription? Why is it required? Why do you say it's not important?

2) Why are IncomingMessage and OutgoingMessage reversed? From the perspective of consumer, shouldn't you Enqueue OutgoingMessage and Subscribe for IncomingMessage? Did you name them from the perspective of the queue server?


What happens if you don't wait for the subscription? The message should still be handled once the subscription is set up, shouldn't it?

Ayende Rahien


I hope to have something out in a month

Ayende Rahien


1) WaitForSubscriptions is there because I still didn't implement immediate queue check,mostly.

2) Mostly because you are looking at the very low level API. And yes, they are from the POV of the queues server

Ayende Rahien


Yes, but that isn't implemented yet.

Comment preview

Comments have been closed on this topic.


  1. RavenDB 3.5 whirl wind tour: You want all the data, you can’t handle all the data - about one day from now
  2. The design of RavenDB 4.0: Making Lucene reliable - 3 days from now
  3. RavenDB 3.5 whirl wind tour: I’ll find who is taking my I/O bandwidth and they SHALL pay - 4 days from now
  4. The design of RavenDB 4.0: Physically segregating collections - 5 days from now
  5. RavenDB 3.5 Whirlwind tour: I need to be free to explore my data - 6 days from now

And 14 more posts are pending...

There are posts all the way to May 30, 2016


  1. RavenDB 3.5 whirl wind tour (14):
    29 Apr 2016 - A large cluster goes into a bar and order N^2 drinks
  2. The design of RavenDB 4.0 (13):
    28 Apr 2016 - The implications of the blittable format
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats