Publish from Consumer...

59 views
Skip to first unread message

Andre Leblanc

unread,
Jun 22, 2016, 4:48:30 PM6/22/16
to masstransit-discuss
Hi!

From the doc: http://docs.masstransit-project.com/en/latest/usage/exceptions.html?highlight=Fault

I tried this

    public class LMSQFaultMessageConsumer : IConsumer<Fault<IEnvelope>>
    {
        public Task Consume(ConsumeContext<Fault<IEnvelope>> context)
        {
            var se = new SystemEnvelope(context);
            return context.Publish<ISystemEnvelope>(se);
        }
    }


My consumer is 
    public class LMSQClientConsumer : LMSQEnvelopeConsumer
    {
        public override void MessageConsumeAsync(ConsumeContext<IEnvelope> context)
        {
            //try
            //{
            var msg = new Envelope(context.Message);
            Console.WriteLine(msg);
            throw new Exception("testing 1..... 2........");
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
    }
}


It seem that I have an infinite loop on my return context.Publish<ISystemEnvelope>(se);

My goal is to have a Windows Service that monitor fault for IEnvelope messages... Can I publish from a Consumer ?

Thanks!
André
        

Alexey Zimarev

unread,
Jun 23, 2016, 2:56:16 PM6/23/16
to masstransit-discuss
Looks like you have some inheritance between IEnvelope and ISystemEnvelope.
Message has been deleted

Andre Leblanc

unread,
Jun 23, 2016, 3:49:18 PM6/23/16
to masstransit-discuss
 public interface IEnvelope
    {
        string AppCd { get; }
        int CompanyId { get; }
        ClientLMSQ.Contract.IDocument Document { get; }
        string RefNumber { get; }
        int? SiteId { get; }
        string TrxCd { get; }
    }

    public interface ISystemEnvelope
    {
       ConsumeContext<Fault<ClientLMSQ.Contract.IEnvelope>> Context { get; }
    }

Not has inheritance but yes IEnvelope is in my ISystemEnvelope...

I understand that inheritance is a feature to consume familly of message... but would it be a different message in my case ?

Thanks!
André
Reply all
Reply to author
Forward
0 new messages