You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a
👍 reaction to the original
issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
pulsar_source exposes the source's producerConfig as top-level attributes - max_pending_messages, max_pending_messages_across_partitions, use_thread_local_producers, batch_builder, compression_type, and the producer crypto settings (resource_pulsar_source.go:55-65).
pulsar_function exposes none of it. utils.FunctionConfig carries the same ProducerConfig *ProducerConfig field (plus a top-level BatchBuilder), but marshalFunctionConfig never populates it, so it is always sent nil. A function's output producer is therefore stuck on broker/runtime defaults, and no amount of Terraform configuration can change its compression, batch builder, or pending-message queue sizing.
This is the same asymmetry that #217 covers on the consumer side, in the opposite direction: there the function was missing a block the sink already had; here it is missing a surface the source already has.
Suggested scope, matching the source's attribute names so the two resources read the same:
attribute
utils.ProducerConfig field
max_pending_messages
MaxPendingMessages
max_pending_messages_across_partitions
MaxPendingMessagesAcrossPartitions
use_thread_local_producers
UseThreadLocalProducers
batch_builder
BatchBuilder
compression_type
CompressionType
The producer crypto attributes could follow the source too, though they are less urgent and could reasonably be split out.
Batching is a follow-on, and is blocked upstream
The motivating case is publish latency. Pulsar Functions got a real producer-batching configuration path in PIP-401 (apache/pulsar#23860), which added BatchingConfig to ProducerConfig and wired it through to the ProducerBuilder for the Java runtime. Two open Pulsar issues track the runtimes that still ignore it:
Those are runtime bugs and do not require any change here - they are about honouring what already arrives in the FunctionDetails protobuf, and neither has been reviewed or merged. But note the ordering if the goal is "batching is tunable from IaC":
utils.ProducerConfig in pulsar-client-go's pulsaradmin has noBatchingConfig field - it carries only MaxPendingMessages, MaxPendingMessagesAcrossPartitions, UseThreadLocalProducers, CryptoConfig, BatchBuilder and CompressionType. PIP-401's addition is not modelled there, so there is currently nothing for provider code to serialize into. That needs an upstream pulsar-client-go change first, now tracked as pulsaradmin: ProducerConfig cannot express PIP-401 batchingConfig apache/pulsar-client-go#1528.
Then a batching_config block could be added here. At that point batching would be Terraform-configurable for Java functions, whose runtime has honoured batchingSpec since PIP-401.
Everything in the table above is reachable today with no upstream dependency, which is why this issue is scoped to producerConfig generally rather than to batching alone.
Note that custom_runtime_options is not a workaround - it maps to customRuntimeOptions, which the worker passes to the runtime, not into producerSpec.
New or Affected Resource(s)
pulsar_function
Potential Terraform Configuration
resource"pulsar_function""function-1" {
provider=pulsar
tenant="public"namespace="default"name="function-1"jar="function://public/default/api-examples@v1"classname="org.apache.pulsar.functions.api.examples.WordCountFunction"inputs=["public/default/input1"]
output="public/default/test-out"# None of these are settable today.compression_type="ZSTD"batch_builder="KEY_BASED"max_pending_messages=1000max_pending_messages_across_partitions=50000use_thread_local_producers=false
}
Community Note
👍 reaction to the original
issue to help the community and maintainers prioritize this request
noise for issue followers and do not help prioritize the request
Description
pulsar_sourceexposes the source'sproducerConfigas top-level attributes -max_pending_messages,max_pending_messages_across_partitions,use_thread_local_producers,batch_builder,compression_type, and the producer crypto settings (resource_pulsar_source.go:55-65).pulsar_functionexposes none of it.utils.FunctionConfigcarries the sameProducerConfig *ProducerConfigfield (plus a top-levelBatchBuilder), butmarshalFunctionConfignever populates it, so it is always sent nil. A function's output producer is therefore stuck on broker/runtime defaults, and no amount of Terraform configuration can change its compression, batch builder, or pending-message queue sizing.This is the same asymmetry that #217 covers on the consumer side, in the opposite direction: there the function was missing a block the sink already had; here it is missing a surface the source already has.
Suggested scope, matching the source's attribute names so the two resources read the same:
utils.ProducerConfigfieldmax_pending_messagesMaxPendingMessagesmax_pending_messages_across_partitionsMaxPendingMessagesAcrossPartitionsuse_thread_local_producersUseThreadLocalProducersbatch_builderBatchBuildercompression_typeCompressionTypeThe producer crypto attributes could follow the source too, though they are less urgent and could reasonably be split out.
Batching is a follow-on, and is blocked upstream
The motivating case is publish latency. Pulsar Functions got a real producer-batching configuration path in PIP-401 (apache/pulsar#23860), which added
BatchingConfigtoProducerConfigand wired it through to theProducerBuilderfor the Java runtime. Two open Pulsar issues track the runtimes that still ignore it:batching_max_publish_delay_ms=10and dropsbatchingSpec. Fix proposed in [fix][fn] Honour producerSpec batching configuration in the Python function runtime apache/pulsar#26392, open and not merged.BatchingMaxPublishDelay: time.Millisecond * 10and dropsbatchingSpec. Fix proposed in [fix][fn] Honour producerSpec batching configuration in the Go function runtime apache/pulsar#26393, open and not merged.Those are runtime bugs and do not require any change here - they are about honouring what already arrives in the
FunctionDetailsprotobuf, and neither has been reviewed or merged. But note the ordering if the goal is "batching is tunable from IaC":utils.ProducerConfiginpulsar-client-go'spulsaradminhas noBatchingConfigfield - it carries onlyMaxPendingMessages,MaxPendingMessagesAcrossPartitions,UseThreadLocalProducers,CryptoConfig,BatchBuilderandCompressionType. PIP-401's addition is not modelled there, so there is currently nothing for provider code to serialize into. That needs an upstreampulsar-client-gochange first, now tracked as pulsaradmin: ProducerConfig cannot express PIP-401 batchingConfig apache/pulsar-client-go#1528.batching_configblock could be added here. At that point batching would be Terraform-configurable for Java functions, whose runtime has honouredbatchingSpecsince PIP-401.Everything in the table above is reachable today with no upstream dependency, which is why this issue is scoped to
producerConfiggenerally rather than to batching alone.Note that
custom_runtime_optionsis not a workaround - it maps tocustomRuntimeOptions, which the worker passes to the runtime, not intoproducerSpec.New or Affected Resource(s)
Potential Terraform Configuration
References
input_specs)BatchingConfigtoProducerConfigbatchingSpec