Skip to main content

Builder

The builder pattern is used to construct new AMPS Sink instances.

Required

The following methods in the builder are required to construct a valid AMPS Sink instance.

Connection to AMPS

One of the following must be used for the AMPS Sink to connect to AMPS.

MethodDescription
setUriSets the URI that will be used to connect to AMPS.
setServerChooserSupplierSets the supplier used to get a server chooser to connect to AMPS. The supplier must be serializable.

Topic for AMPS

The following must be used to determine what topic the AMPS Sink should publish to.

MethodDescription
setTopicSets the topic that will be used by the publish command.

Serializing Data for AMPS

The following method is overloaded to allow either a SerializationSchema or an AMPSSerializationSchema to be used by an AMPS Sink.

MethodDescription
setSerializationSchemaSets the serialization schema that will be used to serialize messages for AMPS.

Building the AMPS Sink

The following method must be used to build the AMPS Sink based on the set builder methods.

MethodDescription
buildReturns the constructed AMPS Sink.

Optional - AMPS Client

The following methods in the builder are optional for functionality related to the AMPS client.

MethodDescription
setClientNameSets the base client name.
setPublishStoreFunctionSets the SerializableFunction that gets each client a store. The parameter is the client name that an individual client of the sink will use.
setPublishCommandSets the publish command for the sink.

Valid commands include:
  • "publish" (Default)
  • "sow_delete"
  • "delta_publish" (May require a custom serialization schema)
setFailedWriteHandlerSupplierSets the supplier that gets each client a FailedWriteHandler. The supplier must be serializable.
setReconnectDelayStrategySupplierSets the supplier that gets each client a ReconnectDelayStrategy. Default uses exponential delay. The supplier must be serializable.
setExceptionListenerSupplierSets the supplier that gets each client an exception listener. The supplier must be serializable.
setHeartbeatSets the heartbeat interval in seconds for the clients.
setRetryOnDisconnectSet whether or not messages being sent to the server should retry if the client is disconnected.
setExpirationSets the expiration for SOW/queue messages sent.
setCorrelationIdSets the correlation ID to use on every message sent to AMPS from this sink. Must contain only Base64 characters.

The correlation ID provided by an AMPSSerializationSchema will override the correlation ID provided here. If there is no correlation ID provided by the schema, then this value will be used.
setConnectorInitializerSets the ConnectorInitializer that will run its init(HAClient) method before the reader connects to AMPS. This can be used to execute code such as setting up an SSLContext for the AMPS clients.

Optional - Other

The following methods in the builder are optional for additional functionality not directly related to the AMPS client.

MethodDescription
setDeliveryGuaranteeSets the sink's delivery guarantee. Default is NONE.

This should only be set to AT_LEAST_ONCE or EXACTLY_ONCE if checkpointing is enabled. EXACTLY_ONCE requires strictly increasing timestamps. AT_LEAST_ONCE should be used over EXACTLY_ONCE for message queues.
setUseSuffixSets the flag for if a suffix should be appended to the client name. Default is false, but it will be set to true if parallelism is greater than 1.