First, Happy Holidays. Thanks for all the support!
I’m using the Coravel scheduling library and looking at using the MQ Background Server in Service Stack to publish a message. This is setup in the startup.cs and the only reference I have is to the AppHost so my question is, “Is this the correct way to publish the message from the AppHost’s reference?”
appHost.Resolve<IMessageService>().MessageFactory.CreateMessageProducer().Publish(new WeeklyReportScheduler()))
A more full set of code:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
appHost = new AppHost
{
AppSettings = new MultiAppSettings(
new EnvironmentVariableSettings(),
new NetCoreAppSettings(Configuration),
new AppSettings())
};
app.UseServiceStack(appHost);
var provider = app.ApplicationServices;
provider.UseScheduler(scheduler =>
{
scheduler.Schedule(()=> appHost.Resolve<IMessageService>().MessageFactory.CreateMessageProducer().Publish(new WeeklyReportScheduler())).DailyAtHour(14);
}).OnError((exception) =>
Console.WriteLine(exception.Message)
);
}