private void NackMessage(HttpEntityManager http, UriTemplateMatch match)
        {
            if (_httpForwarder.ForwardRequest(http))
            {
                return;
            }
            var envelope  = new NoopEnvelope();
            var groupname = match.BoundVariables["subscription"];
            var stream    = match.BoundVariables["stream"];
            var messageId = match.BoundVariables["messageId"];
            var nakAction = GetNackAction(http, match);
            var id        = Guid.NewGuid();

            if (!Guid.TryParse(messageId, out id))
            {
                http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid",
                                 exception => { });
                return;
            }

            var cmd = new ClientMessage.PersistentSubscriptionNackEvents(
                Guid.NewGuid(),
                Guid.NewGuid(),
                envelope,
                BuildSubscriptionGroupKey(stream, groupname),
                "Nacked from HTTP",
                nakAction,
                new[] { id },
                http.User);

            Publish(cmd);
            http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
        }
Exemplo n.º 2
0
        private void AckMessages(HttpEntityManager http, UriTemplateMatch match)
        {
            var envelope   = new NoopEnvelope();
            var groupname  = match.BoundVariables["subscription"];
            var stream     = match.BoundVariables["stream"];
            var messageIds = match.BoundVariables["messageIds"];
            var ids        = new List <Guid>();

            foreach (var messageId in messageIds.Split(new[] { ',' }))
            {
                Guid id;
                if (!Guid.TryParse(messageId, out id))
                {
                    http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
                    return;
                }
                ids.Add(id);
            }

            var cmd = new ClientMessage.PersistentSubscriptionAckEvents(
                Guid.NewGuid(),
                Guid.NewGuid(),
                envelope,
                BuildSubscriptionGroupKey(stream, groupname),
                ids.ToArray(),
                http.User);

            Publish(cmd);
            http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
        }
        private void AckMessages(HttpEntityManager http, UriTemplateMatch match)
        {
            var envelope = new NoopEnvelope();
            var groupname = match.BoundVariables["subscription"];
            var stream = match.BoundVariables["stream"];
            var messageIds = match.BoundVariables["messageIds"];
            var ids = new List<Guid>();
            foreach (var messageId in messageIds.Split(new[] { ',' }))
            {
                Guid id;
                if (!Guid.TryParse(messageId, out id))
                {
                    http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
                    return;
                }
                ids.Add(id);
            }

            var cmd = new ClientMessage.PersistentSubscriptionAckEvents(
                                             Guid.NewGuid(),
                                             Guid.NewGuid(),
                                             envelope,
                                             BuildSubscriptionGroupKey(stream, groupname),
                                             ids.ToArray(),
                                             http.User);
            Publish(cmd);
            http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
        }
Exemplo n.º 4
0
        private void CreatePredefinedProjection(string name, Type handlerType, string config)
        {
            IEnvelope envelope = new NoopEnvelope();

            var postMessage = new ProjectionManagementMessage.Post(
                envelope, ProjectionMode.Persistent, name, "native:" + handlerType.Namespace + "." + handlerType.Name,
                config, enabled: false);

            _publisher.Publish(postMessage);
        }
Exemplo n.º 5
0
        private void CreateSystemProjection(string name, Type handlerType, string config)
        {
            IEnvelope envelope = new NoopEnvelope();

            var postMessage = new ProjectionManagementMessage.Post(
                envelope, ProjectionMode.Continuous, name, ProjectionManagementMessage.RunAs.System, "native:" + handlerType.Namespace + "." + handlerType.Name,
                config, enabled: false, checkpointsEnabled: true, emitEnabled: true, enableRunAs: true);

            _publisher.Publish(postMessage);
        }
Exemplo n.º 6
0
 public void Handle(CoreProjectionStatusMessage.Stopped message)
 {
     if (_startStandardProjections)
     {
         if (_standardProjections.Contains(message.Name))
         {
             _standardProjections.Remove(message.Name);
             var envelope = new NoopEnvelope();
             _masterMainBus.Publish(new ProjectionManagementMessage.Command.Enable(envelope, message.Name, ProjectionManagementMessage.RunAs.System));
         }
     }
 }
Exemplo n.º 7
0
        public void Start()
        {
            if (_masterInputQueue != null)
                _masterInputQueue.Start();
            foreach (var queue in _coreQueues)
                queue.Value.Start();

            if (_developmentMode) {
                var standardProjections = new List<string> { "$by_category", "$stream_by_category", "$streams", "$by_event_type" };
                foreach (var standardProjection in standardProjections) {
                    var envelope = new NoopEnvelope();
                    _masterMainBus.Publish(new ProjectionManagementMessage.Command.Enable(envelope, standardProjection, ProjectionManagementMessage.RunAs.System));
                }
            }
        }
Exemplo n.º 8
0
        public void Start()
        {
            if (_masterInputQueue != null)
            {
                _masterInputQueue.Start();
            }
            foreach (var queue in _coreQueues)
            {
                queue.Value.Start();
            }

            if (_developmentMode)
            {
                var standardProjections = new List <string> {
                    "$by_category", "$stream_by_category", "$streams", "$by_event_type"
                };
                foreach (var standardProjection in standardProjections)
                {
                    var envelope = new NoopEnvelope();
                    _masterMainBus.Publish(new ProjectionManagementMessage.Command.Enable(envelope, standardProjection, ProjectionManagementMessage.RunAs.System));
                }
            }
        }
 private void NackMessage(HttpEntityManager http, UriTemplateMatch match)
 {
     var envelope = new NoopEnvelope();
     var groupname = match.BoundVariables["subscription"];
     var stream = match.BoundVariables["stream"];
     var messageId = match.BoundVariables["messageId"];
     var nakAction = GetNackAction(http, match);
     var id = Guid.NewGuid();
     if (!Guid.TryParse(messageId, out id))
     {
         http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
         return;
     }
     var cmd = new ClientMessage.PersistentSubscriptionNackEvents(
                                      Guid.NewGuid(),
                                      Guid.NewGuid(),
                                      envelope,
                                      BuildSubscriptionGroupKey(stream, groupname),
                                      "Nacked from HTTP",
                                      nakAction,
                                      new[] { id },
                                      http.User);
     Publish(cmd);
     http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
 }