I'm new to MT (and Quartz) and trying to implement scheduled messaging by reading CQRS Journey tutorials.
I need a way to schedule command to trigger in 15 minutes, but I cannot find any tutorial how to setup Quartz.
It only works when I use in memory scheduler, but I want to know how to make reliable solution.
Below is my minimal code sample and I want to know where I can find more information how to setup Quartz (storage and configuration) for .NET Core 2.0 application
using MassTransit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MTSchTest
{
class Program
{
static void Main(string[] args)
{
var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
var host = cfg.Host(new Uri("rabbitmq://localhost/"), h =>
{
h.Username("guest");
h.Password("guest");
});
cfg.UseMessageScheduler(new Uri("rabbitmq://localhost/quartz")); // This doesn't work, is there any tutorial how to configure, e.g. SQLServer DB storage
//cfg.UseInMemoryScheduler(); // This only works
cfg.ReceiveEndpoint(host, "messages", ep =>
{
ep.Handler<SampleMessage>(context =>
{
return Task.CompletedTask;
});
});
});
busControl.Start();
var sendEndpoint = busControl.GetSendEndpoint(new Uri("rabbitmq://localhost/quartz")).Result;
sendEndpoint.ScheduleSend(new Uri("rabbitmq://localhost/messages"), DateTime.Now.AddSeconds(5), new SampleMessage() { Name = "Test"});
Console.ReadLine();
}
}
public class SampleMessage
{
public string Name { get; set; }
}
}