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:

Em minha experiência, a inovação acontece a partir de um dos seguintes gatilhos: A área de negócios identifica uma demanda...
Comunidades técnicas são sistemas complexos! Assim, não podem ser transformadas de maneira prescritiva. Não é razoável esperar que os comportamentos...
Quando estamos desenvolvendo aplicações distribuídas, não devemos nos perguntar se teremos problemas de conectividade. No lugar disso, devemos nos perguntar...
If you ask me one tip to improve the performance of your applications, it would be: Design your objects to...
Este é o primeiro post da série em que vou compartilhar algum conhecimento sobre como desenvolver uma aplicação de verdade...
Uma das premissas fundamentais do conceito de contrato social é que nós, como indivíduos livres, abrimos mão do direito natural...