protected override void InternalOnNext(Message value)
        {
            dynamic handler = handlerFactory.Create();

            var se = new SearchableEvent()
            {
                Event = (IEvent)value.Payload,
                AggregateId = value.Headers["ar_id"],
                Revision = int.Parse(value.Headers["ar_revision"]),
                Timestamp = DateTime.Parse(value.Headers["publish_timestamp"]),
                EventPosition = int.Parse(value.Headers["event_position"]),
            };
            handler.Handle((dynamic)se);
        }
Exemple #2
0
        protected override void InternalOnNext(Message value)
        {
            dynamic handler = handlerFactory.Create();

            var se = new SearchableEvent()
            {
                Event         = (IEvent)value.Payload,
                AggregateId   = value.Headers["ar_id"],
                Revision      = int.Parse(value.Headers["ar_revision"]),
                Timestamp     = DateTime.Parse(value.Headers["publish_timestamp"]),
                EventPosition = int.Parse(value.Headers["event_position"]),
            };

            handler.Handle((dynamic)se);
        }
Exemple #3
0
        public bool Index(SearchableEvent @event)
        {
            var eventType = Uri.EscapeDataString(typeEvaluator.Evaluate(@event.EventInternal, OverqualifiedNameInspector.DefaultInspectionLimit));
            var request   = new RestRequest(@event.Event.GetType().GetContractId().ToLowerInvariant() + "/" + eventType, Method.POST);

            var body = json.Serialize(@event);

            request.AddParameter("text/json", body, ParameterType.RequestBody);
            var response  = client.Execute(request);
            var isSuccess = response.StatusCode == System.Net.HttpStatusCode.Created;

            if (isSuccess == false)
            {
                string error =
                    "Unable to index event in Projections." + Environment.NewLine +
                    "Request: " + body + Environment.NewLine +
                    "Response: " + response.StatusCode + " " + response.ErrorMessage;
                throw new Exception(error);
            }
            return(isSuccess);
        }
Exemple #4
0
 public void Handle(SearchableEvent @event)
 {
     projection.Index(@event);
 }
 public void Handle(SearchableEvent @event)
 {
     projection.Index(@event);
 }