I was recently assigned to a new project where I stumbled on the below code.
I'm new to MassTransit, but after reading the documentation, I believe that setting JobOptions<TJob>
for a normal consumer might have zero effect? and that that bit of code can safely be removed?
The MyConsumer
class implements IConsumer<Batch<MyConsumer.Message>>
configure
.AddConsumer<MyConsumer>(consumer =>
{
consumer.Options<JobOptions<MyConsumer.Message>>(options =>
{
options
.SetJobTimeout(TimeSpan.FromMinutes(30))
.SetRetry(r => r.Interval(2, TimeSpan.FromMinutes(2)));
});
})
.Endpoint(endpoint => endpoint.Name = TopicNames.MyTopic);
Setting job options for a consumer that isn't a job consumer is 100% pointless.