Exemple #1
0
 /// <summary>
 /// Default ctor
 /// </summary>
 /// <param name="ceReader"></param>
 /// <param name="logger"></param>
 public CEventConsumer(ICloudEventReader ceReader, ILogger <CEventConsumer> logger) : base(ceReader, logger)
 {
 }
Exemple #2
0
 /// <summary>
 /// Ctor with CloudEvent(s) reader and logger
 /// </summary>
 /// <param name="ceReader"></param>
 /// <param name="logger"></param>
 public EventConsumer(ICloudEventReader ceReader, ILogger <EventConsumer <T> > logger)
 {
     this._ceReader = ceReader;
     this._logger   = logger;
 }
        /// <summary>
        /// Reconstructs a CloudEvent from the <see cref="IGenericEvent{T}"/> consumer context and returns the payload found in the CloudEvent envelope
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="context"></param>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static object GetCloudEventsPayload <T>(this ConsumeContext <IGenericEvent <T> > context, ICloudEventReader reader)
        {
            object result = null;

            if (reader != null)
            {
                result = reader.GetPayload(context.Message.EventData);
            }

            return(result);
        }
Exemple #4
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public EventConsumer()
 {
     this._ceReader = HostHelpers.serviceProvider.GetService <ICloudEventReader>();
     this._logger   = HostHelpers.serviceProvider.GetService <ILogger <EventConsumer <T> > >();
 }