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.
| Method | Description |
|---|---|
| setUri | Sets the URI that will be used to connect to AMPS. |
| setServerChooserSupplier | Sets 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.
| Method | Description |
|---|---|
| setTopic | Sets 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.
| Method | Description |
|---|---|
| setSerializationSchema | Sets 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.
| Method | Description |
|---|---|
| build | Returns the constructed AMPS Sink. |
Optional - AMPS Client
The following methods in the builder are optional for functionality related to the AMPS client.
| Method | Description |
|---|---|
| setClientName | Sets the base client name. |
| setPublishStoreFunction | Sets the SerializableFunction that gets each client a store. The parameter is the client name that an individual client of the sink will use. |
| setPublishCommand | Sets the publish command for the sink. Valid commands include:
|
| setFailedWriteHandlerSupplier | Sets the supplier that gets each client a FailedWriteHandler. The supplier must be serializable. |
| setReconnectDelayStrategySupplier | Sets the supplier that gets each client a ReconnectDelayStrategy. Default uses exponential delay. The supplier must be serializable. |
| setExceptionListenerSupplier | Sets the supplier that gets each client an exception listener. The supplier must be serializable. |
| setHeartbeat | Sets the heartbeat interval in seconds for the clients. |
| setRetryOnDisconnect | Set whether or not messages being sent to the server should retry if the client is disconnected. |
| setExpiration | Sets the expiration for SOW/queue messages sent. |
| setCorrelationId | Sets 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. |
| setConnectorInitializer | Sets 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.
| Method | Description |
|---|---|
| setDeliveryGuarantee | Sets 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. |
| setUseSuffix | Sets 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. |