Package com.linkedin.venice.samza
Class VeniceSystemProducer
java.lang.Object
com.linkedin.venice.samza.VeniceSystemProducer
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.samza.system.SystemProducer
public class VeniceSystemProducer
extends Object
implements org.apache.samza.system.SystemProducer, Closeable
VeniceSystemProducer defines the interfaces for Samza jobs to send data to Venice stores.
Samza jobs talk to either parent or child controller depending on the aggregate mode config.
The decision of which controller should be used is made in VeniceSystemFactory.
The "Primary Controller" term is used to refer to whichever controller the Samza job should talk to.
The primary controller should be:
1. The parent controller when the Venice system is deployed in a multi-colo mode and either:
a. Version.PushType is Version.PushType.BATCH or Version.PushType.STREAM_REPROCESSING;
2. The child controller when either:
a. The Venice system is deployed in a single-colo mode; or
b. The Version.PushType is Version.PushType.STREAM and the job is configured to write data in NON_AGGREGATE mode-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected ControllerResponsecontrollerRequestWithRetry(Supplier<ControllerResponse> supplier, int retryLimit) protected ObjectconvertPartialUpdateToFullPut(Pair<Integer, Integer> schemaIds, Object incomingWriteValueObject) protected static voidextractConcurrentProducerConfig(Properties veniceWriterProperties, VeniceWriterOptions.Builder builder) voidFlushing the data to Venice store in case VeniceSystemProducer buffers message.AbstractVeniceWriter<byte[],byte[], byte[]> Test methodsprotected AbstractVeniceWriter<byte[],byte[], byte[]> This method is overridden and not used by LinkedIn internally.protected AbstractVeniceWriter<byte[],byte[], byte[]> getVeniceWriter(VersionCreationResponse store, Properties veniceWriterProperties) Please don't remove this method since it is still being used by LinkedIn internally.voidprotected CompletableFuture<Void>Validates, serializes, and writes a key-value pair to Venice.voidprotected voidsetControllerClient(D2ControllerClient controllerClient) voidsetExitMode(SamzaExitMode exitMode) protected voidvoidstart()voidstop()
-
Constructor Details
-
VeniceSystemProducer
-
-
Method Details
-
getRunningFabric
-
controllerRequestWithRetry
protected ControllerResponse controllerRequestWithRetry(Supplier<ControllerResponse> supplier, int retryLimit) -
getTopicName
-
getVeniceWriter
This method is overridden and not used by LinkedIn internally. Please update the overridden method accordingly after modifying this method. -
extractConcurrentProducerConfig
protected static void extractConcurrentProducerConfig(Properties veniceWriterProperties, VeniceWriterOptions.Builder builder) -
getVeniceWriter
protected AbstractVeniceWriter<byte[],byte[], getVeniceWriterbyte[]> (VersionCreationResponse store, Properties veniceWriterProperties) Please don't remove this method since it is still being used by LinkedIn internally. -
setupClientsAndReInitProvider
protected void setupClientsAndReInitProvider() -
start
public void start()- Specified by:
startin interfaceorg.apache.samza.system.SystemProducer
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
stop
public void stop()- Specified by:
stopin interfaceorg.apache.samza.system.SystemProducer
-
register
- Specified by:
registerin interfaceorg.apache.samza.system.SystemProducer
-
send
public void send(String source, org.apache.samza.system.OutgoingMessageEnvelope outgoingMessageEnvelope) - Specified by:
sendin interfaceorg.apache.samza.system.SystemProducer
-
send
Validates, serializes, and writes a key-value pair to Venice. This method handles the full write lifecycle: key schema validation, key/value serialization, schema ID resolution, write-compute conversion for versioned topics, and dispatch to the underlyingVeniceWriter(put, delete, or update). For real-time topics, the value may be wrapped in aVeniceObjectWithTimestampto supply a logical timestamp.- Parameters:
keyObject- the key object; must conform to the store's registered key schemavalueObject- the value object, ornullfor a delete. For real-time topics, may be aVeniceObjectWithTimestampwrapping the value with a timestamp.- Returns:
- a
CompletableFuturethat completes when the write is acknowledged
-
put
-
delete
-
flush
Flushing the data to Venice store in case VeniceSystemProducer buffers message.- Specified by:
flushin interfaceorg.apache.samza.system.SystemProducer- Parameters:
s- String representing the source of the message. Currently, VeniceSystemProducer is not using this param.
-
convertPartialUpdateToFullPut
-
setExitMode
-
getKafkaBootstrapServers
Test methods -
getInternalWriter
-
setControllerClient
-