How to publish event in nservice bus


(Bheesham Kumar) #1

I want to call event using below function.

foreach( int iKey in dicEvent.Keys)
                            IList<PriceReceivedEvent> lstPrice = dicMprEvent[iKey];
                            await context.Publish(new PriceReceivedListEvent() { PriceReceivedEvents = lstPrice.ToList() }).ConfigureAwait(false);

this class I created for event

  public class PriceReceivedListEvent 
      public  IList<PriceReceivedEvent> PriceReceivedEvents { get; set; }

and trying to call this handler.

     public async Task Handle(PriceReceivedListEvent message, IMessageHandlerContext context)
                IList<PriceReceivedEvent> lstPrices = message.PriceReceivedEvents;

what i am doing wrong. Please suggest.

(Mick) #2

Most likely it has to do with the subscription/endpoint mapping for that endpoint handling the published event.

(Dennis van der Stelt) #3

@mick24 is probably right. If you post all endpoint configuration available, we might be able to investigate what is missing and provide you with the solution.

(Bheesham Kumar) #4

Thank for answer, i configured the endpoint and now its working

(Dennis van der Stelt) #5

Good to hear! Thanks for letting us know!