public void Handle(ProjectionManagementMessage.Command.GetStatistics message)
 {
     if (!_started)
     {
         return;
     }
     if (!string.IsNullOrEmpty(message.Name))
     {
         var projection = GetProjection(message.Name);
         if (projection == null)
         {
             message.Envelope.ReplyWith(new ProjectionManagementMessage.NotFound());
         }
         else
         {
             message.Envelope.ReplyWith(
                 new ProjectionManagementMessage.Statistics(new[] { projection.GetStatistics() }));
         }
     }
     else
     {
         var statuses = (from projectionNameValue in _projections
                         let projection = projectionNameValue.Value
                                          where !projection.Deleted
                                          where
                                          message.Mode == null || message.Mode == projection.GetMode() ||
                                          (message.Mode.GetValueOrDefault() == ProjectionMode.AllNonTransient &&
                                           projection.GetMode() != ProjectionMode.Transient)
                                          let status = projection.GetStatistics()
                                                       select status).ToArray();
         message.Envelope.ReplyWith(new ProjectionManagementMessage.Statistics(statuses));
     }
 }
        public void Handle(ProjectionManagementMessage.Command.GetStatistics message)
        {
            var command = new GetStatisticsCommand {
                Name           = message.Name,
                IncludeDeleted = message.IncludeDeleted,
                Mode           = message.Mode
            };

            _writer.PublishCommand("$get-statistics", command);
        }