@Internal public final class UnboundedBatchedSolaceWriter extends UnboundedSolaceWriter
The DoFn will create several JCSMP sessions per VM, and the sessions and producers will be reused across different threads (if the number of threads is higher than the number of sessions, which is probably the most common case).
The producer uses the JCSMP send multiple mode to publish a batch of messages together with a single API call. The acks from this publication are also processed in batch, and returned as the output of the DoFn.
The batch size is 50, and this is currently the maximum value supported by Solace.
There are no acks if the delivery mode is set to DIRECT.
This writer DoFn offers higher throughput than UnboundedStreamingSolaceWriter
but also
higher latency.
DoFn.AlwaysFetched, DoFn.BoundedPerElement, DoFn.BundleFinalizer, DoFn.Element, DoFn.FieldAccess, DoFn.FinishBundle, DoFn.FinishBundleContext, DoFn.GetInitialRestriction, DoFn.GetInitialWatermarkEstimatorState, DoFn.GetRestrictionCoder, DoFn.GetSize, DoFn.GetWatermarkEstimatorStateCoder, DoFn.Key, DoFn.MultiOutputReceiver, DoFn.NewTracker, DoFn.NewWatermarkEstimator, DoFn.OnTimer, DoFn.OnTimerContext, DoFn.OnTimerFamily, DoFn.OnWindowExpiration, DoFn.OnWindowExpirationContext, DoFn.OutputReceiver<T>, DoFn.ProcessContext, DoFn.ProcessContinuation, DoFn.ProcessElement, DoFn.RequiresStableInput, DoFn.RequiresTimeSortedInput, DoFn.Restriction, DoFn.Setup, DoFn.SideInput, DoFn.SplitRestriction, DoFn.StartBundle, DoFn.StartBundleContext, DoFn.StateId, DoFn.Teardown, DoFn.TimerFamily, DoFn.TimerId, DoFn.Timestamp, DoFn.TruncateRestriction, DoFn.UnboundedPerElement, DoFn.WatermarkEstimatorState, DoFn.WindowedContext
Constructor and Description |
---|
UnboundedBatchedSolaceWriter(SerializableFunction<Solace.Record,Destination> destinationFn,
SessionServiceFactory sessionServiceFactory,
DeliveryMode deliveryMode,
SolaceIO.SubmissionMode submissionMode,
int producersMapCardinality,
boolean publishLatencyMetrics) |
Modifier and Type | Method and Description |
---|---|
void |
finishBundle(DoFn.FinishBundleContext context) |
void |
flushBundle(DoFn.OnTimerContext context) |
void |
processElement(KV<java.lang.Integer,Solace.Record> element,
Timer bundleFlusherTimer,
Instant timestamp) |
addToCurrentBundle, createMessagesArray, createSingleMessage, getCurrentBundle, getCurrentBundleTimestamp, getDeliveryMode, getDestinationFn, getFailedLatencyMetric, getProducersMapCardinality, getPublishLatencyMetric, getSubmissionMode, publishResults, setCurrentBundleTimestamp, shouldPublishLatencyMetrics, solaceSessionServiceWithProducer, startBundle, teardown, updateProducerIndex
getAllowedTimestampSkew, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData, prepareForProcessing
public UnboundedBatchedSolaceWriter(SerializableFunction<Solace.Record,Destination> destinationFn, SessionServiceFactory sessionServiceFactory, DeliveryMode deliveryMode, SolaceIO.SubmissionMode submissionMode, int producersMapCardinality, boolean publishLatencyMetrics)
@DoFn.ProcessElement public void processElement(@DoFn.Element KV<java.lang.Integer,Solace.Record> element, @DoFn.TimerId(value="bundle_flusher") Timer bundleFlusherTimer, @DoFn.Timestamp Instant timestamp)
@DoFn.FinishBundle public void finishBundle(DoFn.FinishBundleContext context) throws java.io.IOException
java.io.IOException
@DoFn.OnTimer(value="bundle_flusher") public void flushBundle(DoFn.OnTimerContext context) throws java.io.IOException
java.io.IOException