Exemplo n.º 1
0
 public EventMessage(string endpoint, EventFlowType flow, IEnumerable <EventParameter> parameters)
 {
     Id         = Snowflake.Next();
     Endpoint   = endpoint;
     Flow       = flow;
     Parameters = parameters;
 }
Exemplo n.º 2
0
        protected async Task <EventMessage> SendInternal(EventFlowType flow, ISource source, string endpoint,
                                                         params object[] args)
        {
            var stopwatch = StopwatchUtil.StartNew();
            var message   = new EventMessage(endpoint, flow,
                                             args.Select(self => new EventParameter(Serialization.Serialize(self))));

            if (PrepareDelegate != null)
            {
                stopwatch.Stop();

                await PrepareDelegate(EventConstant.InboundPipeline, source, message);

                stopwatch.Start();
            }

            var buffer = Serialization.Serialize(message);

            PushDelegate(EventConstant.InboundPipeline, source, buffer);
            Logger.Debug(
                $"[{endpoint}] Sent {buffer.Length} byte(s) to {source} in {stopwatch.Elapsed.TotalMilliseconds}ms");

            return(message);
        }