Exemplo n.º 1
0
 public RemoveFromReadQueueAspect(IHandleMessage <Message> action, IReadMessageContext context, IBusConfig config, ILogMessages logger)
 {
     _context = context;
     _config  = config;
     _logger  = logger;
     _inner   = action;
 }
Exemplo n.º 2
0
 public Bus(IBusConfig config, ILogMessages logger, IMessageQueue errorQueue, IMessageQueue readQueue, IEnumerable <IMessageQueue> writeQueues)
 {
     _config            = config;
     _logger            = logger;
     _errorQueue        = errorQueue;
     _readQueue         = readQueue;
     _writeQueueManager = new WriteQueueManager(_config.AutoDistributeOnSend, writeQueues);
 }
Exemplo n.º 3
0
        private static int Deploy(INotifier notificaiton, ILogMessages logMessages, EnvironmentDeployment environmentDeployment, int maximumParalleDeployments, IEnumerable <IComponentVertexDeployer> deployers)
        {
            var cancellationTokenSource = new CancellationTokenSource();
            var deploymentExecutor      = new DeploymentExecutor(deployers, environmentDeployment, cancellationTokenSource.Token, logMessages, notificaiton, maximumParalleDeployments);
            var allDeploymentsSucceded  = deploymentExecutor.Execute().ConfigureAwait(false).GetAwaiter().GetResult();

            return(allDeploymentsSucceded ? 0 : 1);
        }
Exemplo n.º 4
0
 public Bus(IBusConfig config, ILogMessages logger, IMessageQueue errorQueue, IMessageQueue readQueue, IEnumerable <IMessageQueue> writeQueues)
 {
     _config      = config;
     _logger      = logger;
     _errorQueue  = errorQueue;
     _readQueue   = readQueue;
     _writeQueues = writeQueues;
 }
Exemplo n.º 5
0
 public LogTimingCommand(
     IEncapsulateApplicationSpecificFunctionality innerCommand,
     ICanMonitorTime stopWatch,
     ILogMessages logger)
 {
     _innerCommand = innerCommand;
     _stopWatch = stopWatch;
     _logger = logger;
 }
Exemplo n.º 6
0
 public LogTimingCommand(
     IEncapsulateApplicationSpecificFunctionality innerCommand,
     ICanMonitorTime stopWatch,
     ILogMessages logger)
 {
     _innerCommand = innerCommand;
     _stopWatch    = stopWatch;
     _logger       = logger;
 }
Exemplo n.º 7
0
 public DeploymentExecutor(IEnumerable <IComponentVertexDeployer> deployers, EnvironmentDeployment environmentDeployment, CancellationToken cancellationToken, ILogMessages logMessages, IProgress <ComponentVertexDeploymentProgress> progress, int maximumParallelDeployments = 4)
 {
     _deployers             = deployers;
     _environmentDeployment = environmentDeployment;
     _cancellationToken     = cancellationToken;
     _logMessages           = logMessages;
     _progress = progress;
     _maximumParallelDeployments = maximumParallelDeployments;
 }
Exemplo n.º 8
0
 public FailFastAspect(IHandleMessage <Message> action, IBusConfig config, ILogMessages logger)
 {
     _inner  = action;
     _config = config;
     _logger = logger;
 }
Exemplo n.º 9
0
 /// <summary>
 /// WithLogging - The object that will be responsible for outputting log information
 /// </summary>
 /// <param name="logger">The instance of an object implmenting the ILogMessage interface</param>
 public BusBuilder WithLogging(ILogMessages logger)
 {
     _logger = logger;
     return(this);
 }
Exemplo n.º 10
0
 public CopyMessageHandler(IWriteMessageContext toContext, IBusConfig config, ILogMessages logger)
 {
     _toContext = toContext;
     _config    = config;
     _logger    = logger;
 }
Exemplo n.º 11
0
 public MiniBusMessageQueue(MessageQueue queue, ILogMessages logger, bool autoPurgeSystemJournal)
 {
     _queue = queue;
     _logger = logger;
     _autoPurgeSystemJournal = autoPurgeSystemJournal;
 }
Exemplo n.º 12
0
 public MessageLogger(ILogMessages messages)
 {
     this.messages = messages;
 }
Exemplo n.º 13
0
 public ReceiveMessageHandler(List <Delegate> handlers, IBusConfig config, ILogMessages logger)
 {
     _handlers = handlers;
     _config   = config;
     _logger   = logger;
 }
Exemplo n.º 14
0
 private static INotifier GetNotifier(bool hideDeploymentProgress = false, bool useTeamcity = false, ILogMessages logMessages = null)
 {
     if (hideDeploymentProgress)
     {
         return(null);
     }
     if (useTeamcity || !string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("TEAMCITY_VERSION")))
     {
         return(new TeamcityConsoleDeployNotifier(logMessages));
     }
     return(new ConsoleDeployNotfier(logMessages));
 }
Exemplo n.º 15
0
 public LoggingAspect(IHandleMessage <Message> action, string operation, ILogMessages logger)
 {
     _inner     = action;
     _logger    = logger;
     _operation = operation;
 }
Exemplo n.º 16
0
 public MoveToErrorQueueAspect(IHandleMessage <Message> action, IReadMessageContext context, ILogMessages logger)
 {
     _context = context;
     _logger  = logger;
     _inner   = action;
 }
Exemplo n.º 17
0
 public DiscardFailuresAspect(IHandleMessage <Message> action, IBusConfig config, ILogMessages logger)
 {
     _inner  = action;
     _config = config;
     _logger = logger;
 }
        public ComponentVertexDeploymentResult Deploy(ComponentDeploymentVertex componentDeploymentVertex, CancellationToken cancellationToken, ILogMessages logMessages, IProgress <ComponentVertexDeploymentProgress> progress)
        {
            if (!componentDeploymentVertex.Exists || componentDeploymentVertex.DeploymentAction == PlanAction.Skip)
            {
                return(new ComponentVertexDeploymentResult
                {
                    Status = ComponentVertexDeploymentStatus.Success,
                    Description = logMessages.DeploymentSkipped(componentDeploymentVertex)
                });
            }

            if (componentDeploymentVertex.Version == null)
            {
                throw new Exception("Version for release is null");
            }

            var environment = _repository.Environments.GetEnvironment(_environmentToDeployTo.Name);
            var project     = _repository.Projects.GetProjectByName(componentDeploymentVertex.Name);
            var release     = _repository.Projects.GetRelease(project.Id, componentDeploymentVertex.Version);

            var deployment = new DeploymentResource
            {
                ReleaseId                = release.Id,
                EnvironmentId            = environment.Id,
                Comments                 = _comments,
                ForcePackageDownload     = _forcePackageDownload,
                ForcePackageRedeployment = _forcePackageRedeployment,
            };

            var queuedDeployment = _repository.Deployments.Create(deployment);

            componentDeploymentVertex.DeploymentId = queuedDeployment.Id;
            var deploymentTask = _repository.Tasks.Get(queuedDeployment.TaskId);

            Action <TaskResource[]> interval = tasks =>
            {
                foreach (var task in tasks)
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        _repository.Tasks.Cancel(task);
                    }

                    var duration = new TimeSpan(0);

                    if (task.StartTime.HasValue)
                    {
                        var now = new DateTimeOffset(DateTime.UtcNow);
                        duration = now.Subtract(task.StartTime.Value);
                    }

                    if (progress != null)
                    {
                        var componentVertexDeploymentProgress = new ComponentVertexDeploymentProgress
                        {
                            Vertex       = componentDeploymentVertex,
                            Status       = ComponentVertexDeploymentStatus.InProgress,
                            MinimumValue = 0,
                            MaximumValue =
                                componentDeploymentVertex.DeploymentDuration.HasValue
                                    ? componentDeploymentVertex.DeploymentDuration.Value.Ticks
                                    : 0,
                            Value = duration.Ticks,
                            Text  = logMessages.DeploymentProgress(componentDeploymentVertex, task.Description)
                        };
                        progress.Report(componentVertexDeploymentProgress);
                    }
                }
            };

            _repository.Tasks.WaitForCompletion(deploymentTask, _pollIntervalSeconds, _timeoutAfterMinutes, interval);

            deploymentTask = _repository.Tasks.Get(queuedDeployment.TaskId);

            var result = new ComponentVertexDeploymentResult();

            switch (deploymentTask.State)
            {
            case TaskState.Success:
                result.Status      = ComponentVertexDeploymentStatus.Success;
                result.Description = logMessages.DeploymentSuccess(componentDeploymentVertex);
                break;

            case TaskState.Canceled:
            case TaskState.Cancelling:
                result.Status      = ComponentVertexDeploymentStatus.Cancelled;
                result.Description = logMessages.DeploymentCancelled(componentDeploymentVertex);
                break;

            case TaskState.Failed:
            case TaskState.TimedOut:
                result.Status      = ComponentVertexDeploymentStatus.Failure;
                result.Description = logMessages.DeploymentFailed(componentDeploymentVertex, deploymentTask.ErrorMessage);
                break;

            default:
                result.Status      = ComponentVertexDeploymentStatus.Failure;
                result.Description = logMessages.DeploymentFailed(componentDeploymentVertex, deploymentTask.ErrorMessage);
                break;
            }

            return(result);
        }
Exemplo n.º 19
0
 public BusBuilder WithLogging(ILogMessages logger)
 {
     _logger = logger;
     return this;
 }
 public TeamcityConsoleDeployNotifier(ILogMessages logMessages)
 {
     _logMessages = logMessages;
 }
Exemplo n.º 21
0
 public ObjectLoggingExtensionPoint(ILogMessages logger)
 {
   this.logger = logger;
 }
Exemplo n.º 22
0
 public SendMessageHandler(IWriteMessageContext context, IBusConfig config, ILogMessages logger)
 {
     _context = context;
     _config  = config;
     _logger  = logger;
 }
Exemplo n.º 23
0
 public MiniBusMessageQueue(MessageQueue queue, ILogMessages logger)
 {
     _queue  = queue;
     _logger = logger;
 }
Exemplo n.º 24
0
 public TimedBehaviour(ITimeThings timer, ILogMessages logger)
 {
     this.timer  = timer;
     this.logger = logger;
 }
Exemplo n.º 25
0
        public ComponentVertexDeploymentResult Deploy(ComponentDeploymentVertex vertex, CancellationToken cancellationToken, ILogMessages logMessages, IProgress <ComponentVertexDeploymentProgress> progress)
        {
            if (!vertex.Exists || vertex.VariableAction == VariableAction.Leave)
            {
                return(new ComponentVertexDeploymentResult
                {
                    Status = ComponentVertexDeploymentStatus.Success
                });
            }

            var project = _repository.Projects.GetProjectByName(vertex.Name);
            var release = _repository.Projects.GetRelease(project.Id, vertex.Version);

            _repository.Releases.SnapshotVariables(release);

            return(new ComponentVertexDeploymentResult
            {
                Status = ComponentVertexDeploymentStatus.Success,
                Description = "Updated"
            });
        }
Exemplo n.º 26
0
 public MiniBusMessageQueue(MessageQueue queue, ILogMessages logger, bool autoPurgeSystemJournal)
 {
     _queue  = queue;
     _logger = logger;
     _autoPurgeSystemJournal = autoPurgeSystemJournal;
 }
Exemplo n.º 27
0
 public LogMailingScmBackup(IScmBackup backup, ILogMessages messages, IEmailSender mail)
 {
     this.backup   = backup;
     this.messages = messages;
     this.mail     = mail;
 }
Exemplo n.º 28
0
 public ConsoleDeployNotfier(ILogMessages logMessages)
 {
     _logMessages = logMessages;
 }
Exemplo n.º 29
0
 public ReturnToSourceHandler(IReadMessageContext context, ILogMessages logger)
 {
     _context = context;
     _logger  = logger;
 }
Exemplo n.º 30
0
 public TransactionAspect(IHandleMessage <Message> action, ILogMessages logger)
 {
     _inner  = action;
     _logger = logger;
 }