Re: [masstransit-discuss] MassTransit.Quartz - Scheduling Consumer Doesn't Receive All Messages

53 views
Skip to first unread message
Message has been deleted

Chris Patterson

unread,
Oct 19, 2017, 7:24:00 PM10/19/17
to masstrans...@googlegroups.com
Where is your consumer for the StartPollingMessage?

On Thu, Oct 19, 2017 at 6:14 PM, Jacob Barnes <jmbarn...@gmail.com> wrote:

I have a class publishing messages to be scheduled based on client's preferred poll times to extract their data. My scheduler class doesn't receive every message, many end up in the skipped_queue. The amount of messages received varies. Here is a sample of the code:

       public async Task Consume(ConsumeContext<IUnitScheduled> context)
        {
            try
            {
                await context.ScheduleSend(new Uri(ConfigurationManager.AppSettings["PollingMQ"] + "/polling_service"),
                                            DateTime.Today.Add(context.Message.PollScheduleTime),
                                            new StartPollingMessage
                                            {
                                                PollUnitID = context.Message.PollUnitID,
                                                PollUnitPOS = context.Message.PollUnitPOS,
                                                PollScheduleTime = context.Message.PollScheduleTime,
                                                CorrelationId = context.Message.CorrelationId
                                            });
            }
            catch (Exception ex)
            {
                var debug = "";
            }
        }

        private static void ConfigureBus()
        {
            _busControl = Bus.Factory.CreateUsingRabbitMq(bc =>
            {
                var host = bc.Host(new Uri(ConfigurationManager.AppSettings["PollingMQ"]), h =>
                {
                    h.Username(ConfigurationManager.AppSettings["PollingUserName"]);
                    h.Password(ConfigurationManager.AppSettings["PollingPassword"]);
                });

                //need to install Quartz as a service for this to work
                //bc.UseMessageScheduler(new Uri(ConfigurationManager.AppSettings["PollingScheduler"]));

                //use in-mem for now. This is volatile and messages will be lost if the process is ended.
                bc.UseInMemoryScheduler();

                bc.ReceiveEndpoint(host, "polling_service", ep =>
                {
                    //ep.PrefetchCount = 1; //How many message will be pulled at once.
                    ep.Consumer<PollingScheduler>();
                });
            });
        }

I've tried setting prefetch count and removing it, but no effect. I suppose I could run more than one instance of the scheduler, but I'd prefer to have this one class act appropriately.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/ab1e5dc1-71bc-420d-909e-ff91b50d6603%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Jacob Barnes

unread,
Oct 20, 2017, 11:56:28 AM10/20/17
to masstransit-discuss
Tried to delete my post. I'm not sure what all I changed during testing to get it working, but I'm not having this issue any longer.


Reply all
Reply to author
Forward
0 new messages