/// <summary>
        /// Publish an <see cref="IGenericEvent{CEvent}">IGenericPublisherEvent&lt;CEvent&gt;</see> with <see cref="BasicPayload">BasicPayload</see>
        /// </summary>
        /// <param name="requestContextInfo"></param>
        /// <param name="cToken"></param>
        /// <returns></returns>
        public async Task DoStuffWithATwist(string requestContextInfo,
                                            CancellationToken cToken = default(CancellationToken))
        {
            try
            {
                var basicPayload = new BasicPayload()
                {
                    Id          = 1000,
                    Description = "publisher payload sent with a generic event type",
                    Tags        = new List <string>()
                    {
                        "generic-tag0000", "generic-tag1000", "generic-tag2000", "generic-tag3000"
                    }
                };

                await Publish <BasicPayload, IGenericEvent <CEvent> >(
                    basicPayload, requestContextInfo, cToken);   // request context -> event subject

                _logger.LogInformation($"DoStuffWithATwist: Published an IGenericEvent<CEvent> with `{basicPayload.GetType().Name}` data; event context '{requestContextInfo}'");
            }
            catch (Exception ex)
            {
                // err
                LogException("DoStuffWithATwist", ex);
            }
        }
Example #2
0
        public void SendMessage(MessageType type, BasicPayload payload)
        {
            Message msg = new Message(type, payload);

            SendMessage(msg);
        }
Example #3
0
 public Message(MessageType type, BasicPayload payload)
 {
     this.type    = type;
     this.payload = payload.ToString();
 }