Пример #1
0
        public static int Main(string[] args)
        {
            try
            {
                Native.DisableWindowsErrorReporting();
                Int32 exitCode;
                if (args.Length > 0)
                {
                    var autoExecution = FindArgument(args, "/autoRestart:");
                    if ("true".Equals(autoExecution, StringComparison.OrdinalIgnoreCase))
                    {
                        SetupAutoRestart();
                    }

                    String dsBaseAddress = FindArgument(args, "/dsuris:");
                    String queueName     = FindArgument(args, "/queue:");
                    String handle        = FindArgument(args, "/handle:", "Default");
                    if (String.IsNullOrEmpty(dsBaseAddress) || String.IsNullOrEmpty(queueName))
                    {
                        Console.WriteLine("Error in parameters: dsuris={0} queue={1}", dsBaseAddress, queueName);
                        Console.ReadKey();
                        return(-1);
                    }

                    exitCode = SingleJobStart(dsBaseAddress, queueName, handle);
                    if (exitCode > 0)
                    {
                        ReStart();
                    }
                    return(exitCode);
                }

                Console.WriteLine("Wrong command line. This utilities expetcs following parameters:");
                Console.WriteLine("/dsuris:http://localhost:5123 - List of addresses (comma separated) of document store uris.");
                Console.WriteLine("/queue:tika - Name of the queue");
                Console.WriteLine("/handle:xxxxx - Optional, a string that identify this worker");

                Console.ReadKey();
                return(0);
            }
            catch (Exception ex)
            {
                var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "_lastError.txt");
                File.WriteAllText(fileName, ex.ToString());
                throw;
            }
        }
Пример #2
0
        private static int Main(string[] args)
        {
            var lastErrorFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "_lastError.txt");

            if (File.Exists(lastErrorFileName))
            {
                File.Delete(lastErrorFileName);
            }
            try
            {
                MongoRegistration.RegisterMongoConversions(
                    "NEventStore.Persistence.MongoDB"
                    );

                MongoFlatMapper.EnableFlatMapping(true);

                CommandsExtensions.EnableDiagnostics = true;
                Native.DisableWindowsErrorReporting();
                MongoFlatMapper.EnableFlatMapping(true); //before any chanche that the driver scan any type.
                Int32 executionExitCode;
                if (args.Length == 1 && (args[0] == "install" || args[0] == "uninstall"))
                {
                    executionExitCode = (Int32)StartForInstallOrUninstall();
                }
                else
                {
                    executionExitCode = (Int32)StandardDocumentStoreStart();
                }
                return(executionExitCode);
            }
            catch (Exception ex)
            {
                File.WriteAllText(lastErrorFileName, ex.ToString());
                throw;
            }
        }