Event Store subscription service to MongoDB
<p>I was wondering if it was possible to create a subscription service to <code>Mongo</code> via <code>Get Event Store</code>? Perhaps I have phrased this incorrectly but let me explain. I currently have a process which writes events to a <code>Mongo Database</code> using <code>NEventStore</code>. What I would like to do is have a subscription service which subscribes to a <code>Stream</code> in <code>Mongo</code>.</p>

<p>Not been able to find anything on the interweb about this in particular however is this possible? My question in a nutshell perhaps is can you mix and match the two together or in order to do this I must write my events to <code>eventstore</code> as opposed to <code>Mongo</code>? Perhaps, I am going about this wrong and there is an alternative?</p>

<p>I can see my event being written however it fails to trigger <code>EventAppeared</code>. All of this is being done locally on my machine for now.</p>

<p>I have tried creating a stripped down app which does this:</p>

<ol>
<li><p>Create a subscription using the following</p>

<pre><code>    using (var connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113)))
    {
        connection.SubscribeToStreamAsync(@"mongodb://localhost:27017/Test", false, EventAppeared, SubscriptionDropped);

        var repository = new NEventStoreRepository();
        repository.Write(new SomethingHasHappened("Hello"));

        Console.ReadLine();
    }

private static void SubscriptionDropped(EventStoreSubscription arg1, SubscriptionDropReason arg2, Exception arg3)
{
}

private static void EventAppeared(EventStoreSubscription arg1, ResolvedEvent arg2)
{
}
</code></pre></li>
<li><p>I write an event to my mongo database via NEventStore</p>

<pre><code>public void Write(object @event)
{
    var id = Guid.NewGuid();

    using (var scope = new TransactionScope())
    {
        using (var store = WireupEventStore())
        {
            using (var stream = store.OpenStream(id.ToString(), 0, int.MaxValue))
            {
                stream.Add(new EventMessage { Body = @event });
                stream.CommitChanges(Guid.NewGuid());
                scope.Complete();
            }
        }
    }

    Console.ReadKey();
}

private static IStoreEvents WireupEventStore()
{
    return Wireup
        .Init()
        .LogToOutputWindow()
        .UsingMongoPersistence("NEventStore.MongoDB", new DocumentObjectSerializer())
        .InitializeStorageEngine()
        .UsingJsonSerialization()
        .Build();
}
</code></pre></li>
</ol>