/// <summary>
        /// Use an embedded RavenDb database to store commands
        /// </summary>
        /// <param name="instance">this</param>
        /// <returns>this</returns>
        /// <remarks>You can configure the embedded DB manually like this:
        /// <code>
        /// // create raven
        /// var documentStore = new EmbeddableDocumentStore();
        /// documentStore.Initialize();
        ///
        /// // assign it to the builder.
        /// pipelineBuilder.StoreCommands(new RavenCommandStorage(documentStore));
        /// </code>
        /// </remarks>
        public static PipelineDispatcherBuilder UseRavenDbEmbedded(this PipelineDispatcherBuilder instance)
        {
            var documentStore = new EmbeddableDocumentStore();

            /*{
             *  //Conventions = {IdentityPartsSeparator = "-"},
             *  //DefaultDatabase = "GriffinDecoupled"
             * };*/
            //if (ConfigurationManager.ConnectionStrings["GriffinDecoupled"] != null)
            //documentStore.ConnectionStringName = "GriffinDecoupled";
            documentStore.Initialize();

            instance.StoreCommands(new RavenCommandStorage(documentStore));
            return(instance);
        }
예제 #2
0
파일: Program.cs 프로젝트: kimx/Samples
        private static void Main(string[] args)
        {
            var container = ConfigureGriffinContainer();

            // will recieve any pipeline errors (i.e. failing to deliver the commands)
            var errorHandler = new ErrorHandler();

            // will also assign the pipeline
            var dispatcher = new PipelineDispatcherBuilder(errorHandler)
                             .AsyncDispatching(10)           // allow 10 commands to be dispatched simultaneosly
                             .UseGriffinContainer(container) // Use Griffin.Container (the "griffin.decoupled.container" nuget package)
                             .Build();                       // and lets go.

            // assign it
            CommandDispatcher.Assign(dispatcher);

            Console.WriteLine("We are on thread #" + Thread.CurrentThread.ManagedThreadId);
            CommandDispatcher.Dispatch(new SayHello());

            Console.ReadLine();
        }
예제 #3
0
        private static void Main(string[] args)
        {
            var container = ConfigureGriffinContainer();

            // will recieve any pipeline errors (i.e. failure to deliver the messages)
            var errorHandler = new ErrorHandler();

            // will also assign the pipeline
            var dispatcher = new PipelineDispatcherBuilder(errorHandler)
                             .AsyncDispatching(10)           // allow 10 commands to be dispatched simultaneosly
                             .RetryCommands(3)               // attempt to execute commands three times.
                             .UseGriffinContainer(container) // Use Griffin.Container (the "Griffin.Decoupled.Container" nuget package)
                             .UseRavenDbEmbedded()           // use RavenDb to store pending commands (the "Griffin.Decoupled.RavenDb.Embedded" nuget package)
                             .Build();                       // and lets go.

            // assign it
            CommandDispatcher.Assign(dispatcher);

            Console.WriteLine("We are on thread #" + Thread.CurrentThread.ManagedThreadId);
            CommandDispatcher.Dispatch(new SayHello());

            Console.ReadLine();
        }