Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseMessageSchedulerWithQuartz #20

Open
can-acar opened this issue Jul 23, 2019 · 0 comments
Open

UseMessageSchedulerWithQuartz #20

can-acar opened this issue Jul 23, 2019 · 0 comments

Comments

@can-acar
Copy link

Hocam selam,
Metrobus , UseMessageSchedulerWithQuartz methodunı nasıl kullanıp ayarlanıyor?

methodun aldığı parametreye göre ;

            services.AddMetroBus(x => x.AddConsumer<WorkerConsumer>());

            services.AddSingleton(provider => MetroBusInitializer.Instance
                    .UseRabbitMq(mqConstant.RabbitMQUri, mqConstant.RabbitMQUserName, mqConstant.RabbitMQPassword)
                    .RegisterConsumer<WorkerConsumer>("ilan.schedule.queue", provider)
                    .UseMessageSchedulerWithQuartz("rabbitmq://localhost/quartz")
                    .SetPrefetchCount(16)
                    .UseRateLimiter(20, TimeSpan.FromMinutes(10.0))
                   
                    .Build())
                .BuildServiceProvider();


            services.AddHostedService<BusService>();
            

biçimde ayarladım

consumer ;

 public class WorkerConsumer : IConsumer<WorkerCommand>
    {
        private readonly ILogger<WorkerConsumer> Logger;
        readonly Uri NotificationService;

        public WorkerConsumer(ILogger<WorkerConsumer> logger)
        {
            Logger = logger;
            NotificationService = new Uri("rabbitmq://localhost/notification.queue");
       }

        public Task Consume(ConsumeContext<WorkerCommand> context)
        {
            var IlanId = context.Message.IlanId;
            var EstimateDate = context.Message.EstimateDate;

            context.ScheduleSend(NotificationService, EstimateDate, new NotifyCommand
            {
                IlanId = IlanId
            });
     
            return Task.CompletedTask;
        }

    }
}

çalıştırdıktan sonra estime tarihinde işlem yapmıyor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant