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:

Criar uma visualização para o fluxo de trabalho é uma das primeiras recomendações do Kanban e tem uma série de...
Decidi aprender a programar com R. Aqui está algo que escrevi. ## defining a function makeCacheMatrix <- function(x = matrix())...
The example which motivated this post comes from the excellent book Designing Distributed Systems by Brendan Burns (co-founder of the...
Software em funcionamento é mais relevante que documentação abrangente. Concordo com esse princípio expresso no manifesto ágil. Entretanto, acho que...
In the previous post, I shared an example of how containers could help us to make the code clearer about...
As lojas que podem e que insistem em funcionar, na minha cidade, estão limitando o número de clientes atendidos simultaneamente....
× Precisa de ajuda?