Place this snipped in your ConfigureServices
services
.AddHangfire(x =>
x
.UseSqlServerStorage(
"<connection>")
.UseTopics()
);
services.AddHangfireServer();
services.AddTopicServices();
topicPublisher.EnqueueTopic("topic1");
topicPublisher.EnqueueTopic("topic1", someParams);
[SubscriberJob("topic1")]
public class SampleSubscriber : ISubscriber
{
private readonly IConfiguration _config;
public SampleSubscriber(IConfiguration config)
{
_config = config;
}
public void Execute(object context)
{
}
}