/// <summary> /// Adds the <see cref="IAnonymousProducer"/> and configures a binding between the <typeparam name="TProducer" /> and named <see cref="IProducer"/> instance. /// </summary> /// <param name="builder">The <see cref="IActiveMqBuilder"/>.</param> /// <param name="producerOptions">The <see cref="IAnonymousProducer"/> configuration.</param> /// <param name="producerLifetime">The lifetime with which to register the <typeparam name="TProducer" /> in the container.</param> /// <typeparam name="TProducer">The type of the typed producer. The type specified will be registered in the service collection as /// a transient service by default.</typeparam> /// <returns>The <see cref="IActiveMqBuilder"/> that can be used to configure ActiveMQ Artemis Client.</returns> public static IActiveMqBuilder AddAnonymousProducer <TProducer>(this IActiveMqBuilder builder, ProducerOptions producerOptions, ServiceLifetime producerLifetime = ServiceLifetime.Transient) where TProducer : class { var anonymousProducerConfiguration = new AnonymousProducerConfiguration { MessagePriority = producerOptions.MessagePriority, MessageDurabilityMode = producerOptions.MessageDurabilityMode, MessageIdPolicy = producerOptions.MessageIdPolicy, SetMessageCreationTime = producerOptions.SetMessageCreationTime }; return(builder.AddAnonymousProducer <TProducer>(anonymousProducerConfiguration, producerLifetime)); }
/// <summary> /// Adds the <see cref="IProducer"/> and configures a binding between the <typeparam name="TProducer" /> and named <see cref="IProducer"/> instance. /// </summary> /// <param name="builder">The <see cref="IActiveMqBuilder"/>.</param> /// <param name="address">The address name.</param> /// <param name="producerOptions">The <see cref="IProducer"/> configuration.</param> /// <param name="producerLifetime">The lifetime with which to register the <typeparam name="TProducer" /> in the container.</param> /// <typeparam name="TProducer">The type of the typed producer. The type specified will be registered in the service collection as /// a transient service by default.</typeparam> /// <returns>The <see cref="IActiveMqBuilder"/> that can be used to configure ActiveMQ Artemis Client.</returns> public static IActiveMqBuilder AddProducer <TProducer>(this IActiveMqBuilder builder, string address, ProducerOptions producerOptions, ServiceLifetime producerLifetime = ServiceLifetime.Transient) where TProducer : class { var producerConfiguration = producerOptions.ToConfiguration(); producerConfiguration.Address = address; return(builder.AddProducer <TProducer>(producerConfiguration, producerLifetime)); }