/// <summary> /// Initializes a new instance of the <see cref="Producer<TKey, TData>"/> class. /// </summary> /// <param name="config">The config object.</param> /// <remarks> /// Can be used when all config parameters will be specified through the config object /// and will be instantiated via reflection /// </remarks> public Producer(ProducerConfiguration config) : this( config, ReflectionHelper.Instantiate <IPartitioner <TKey> >(config.PartitionerClass), ProducerPool <TData> .CreatePool(config, ReflectionHelper.Instantiate <IEncoder <TData> >(config.SerializerClass))) { Guard.NotNull(config, "config"); }
/// <summary> /// Initializes a new instance of the <see cref="Producer<TKey, TData>"/> class. /// </summary> /// <param name="config">The config object.</param> /// <param name="partitioner">The partitioner that implements <see cref="IPartitioner<TKey>" /> /// used to supply a custom partitioning strategy based on the message key.</param> /// <param name="encoder">The encoder that implements <see cref="IEncoder<TData>" /> /// used to convert an object of type TData to <see cref="Message" />.</param> /// <remarks> /// Can be used to provide pre-instantiated objects for all config parameters /// that would otherwise be instantiated via reflection. /// </remarks> public Producer( ProducerConfiguration config, IPartitioner <TKey> partitioner, IEncoder <TData> encoder) : this( config, partitioner, ProducerPool <TData> .CreatePool(config, encoder, null)) { Guard.NotNull(config, "config"); Guard.NotNull(encoder, "encoder"); }