Embedded Document Stores and/or In-Memory Databases

The type EmbeddableDocumentStore is gone. But it does not mean that you have no good options to replace his functionality. The technique I share here can be easily adopted in any language or framework.

Are you ready? So, let’s examine the Raven.TestDriver source code.

private static ProcessStartInfo GetProcessStartInfo(TLocator locator)
{
    if (File.Exists(locator.ServerPath) == false)
    {
        throw new FileNotFoundException("Server file was not found", locator.ServerPath);
    }

    using (var currentProcess = Process.GetCurrentProcess())
    {
        var commandArguments = new List
        {
            locator.CommandArguments,
            "--ServerUrl=http://127.0.0.1:0",
            "--RunInMemory=true",
            "--Testing.ParentProcessId=" + currentProcess.Id,
            "--Setup.Mode=None"
        };

        var argumentsString = string.Join(" ", commandArguments);
        return new ProcessStartInfo
        {
            FileName = locator.Command,
            Arguments = argumentsString,
            CreateNoWindow = true,
            RedirectStandardOutput = true,
            RedirectStandardError = true,
            UseShellExecute = false,
        };
    }
}

Yeap! You got it. Our recommendation now is to start a child process instead of having Raven running on the same process of your application.

As you can see, you can now specify a “Parent Process Id” to the RavenDB Server. So, when the “parent process” is gone, Raven will gently stop as well.

Please, note the “RunInMemory” option. Nice, huh?

Let me know if you have any additional questions about this subjects.

Compartilhe este insight:

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Mais insights para o seu negócio

Veja mais alguns estudos e reflexões que podem gerar alguns insights para o seu negócio:

Aprendemos que a priorização das atividades deve ser feita, invariavelmente, pelo time do negócio. Na prática, entretanto, em nosso time,...
Tenho realizado uma série de apresentações, em conferências, onde compartilho um pouco das lições que tenho aprendido implementando microsserviços. Abaixo,...
In a previous post, I wrote about how to support sagas using a Workflow Engine as Saga Execution Coordinator (if...
In the previous post, I shared an example of how containers could help us to make the code clearer about...
Não são raros os casos onde a distância entre um “desejo” e a “realização” é a “tentativa”. Ou seja, partindo...
As you probably noted, my old blog posts are gone! It’s sad, but I had to take this way. Main reasons:...