/// <summary> /// Registers a consumer and associated message type using the competing consumer pattern. With the competing consumer pattern, only the first consumer on a given node to obtain a message will handle that message. /// This is in contrast to the Publisher-Subscriber pattern, where a message will be delivered to the consumer on all nodes in a cluster. To register a Publisher-Subscriber consumer, use <seealso cref="AddPubSubConsumer{TConsumer,TMessage}"/> /// </summary> public static ElsaOptionsBuilder AddCompetingConsumer <TConsumer, TMessage>(this ElsaOptionsBuilder elsaOptions, string?queueName = default) where TConsumer : class, IHandleMessages <TMessage> { elsaOptions.AddCompetingConsumerService <TConsumer, TMessage>(); elsaOptions.AddCompetingMessageType <TMessage>(queueName); return(elsaOptions); }