Class WebSocketFirehoseProducerWorker<T>
- All Implemented Interfaces:
io.aleph0.yap.core.Measureable<FirehoseMetrics>,io.aleph0.yap.core.ProducerWorker<Message<T>>,io.aleph0.yap.core.worker.MeasuredProducerWorker<Message<T>,,FirehoseMetrics> FirehoseProducerWorker<Message<T>>
FirehoseProducerWorker that connects to a WebSocket server and sends messages to a
Sink.
The given WebSocketFirehoseProducerWorker.MessageFactory is used to create messages from the text and binary frames
received from the WebSocket server. The WebSocketFirehoseProducerWorker.Configurator is used to configure the
WebSocket client and the HTTP client used to connect to the server.
Because the MessageFactory is responsible for creating messages, it is also responsible
for defining the ack and nack semantics. Users should take care to ensure that the implemented
semantics match the required semantics, particularly idempotence and
mutually exclusive acks and nacks.
On sink failure, the worker will close the socket gracefully and fail.
On socket error, the worker will simply close the socket and fail.
On interrupt, the worker will attempt to close the connection gracefully. If this takes too long, then it will simply close the socket. The worker will then propagate the interrupt.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceclassThis class has to be public so Jetty can see it.static interface -
Constructor Summary
ConstructorsConstructorDescriptionWebSocketFirehoseProducerWorker(URI uri, WebSocketFirehoseProducerWorker.Configurator configurator, WebSocketFirehoseProducerWorker.MessageFactory<T> messageFactory) WebSocketFirehoseProducerWorker(URI uri, WebSocketFirehoseProducerWorker.MessageFactory<T> messageFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
-
Constructor Details
-
WebSocketFirehoseProducerWorker
public WebSocketFirehoseProducerWorker(URI uri, WebSocketFirehoseProducerWorker.MessageFactory<T> messageFactory) -
WebSocketFirehoseProducerWorker
public WebSocketFirehoseProducerWorker(URI uri, WebSocketFirehoseProducerWorker.Configurator configurator, WebSocketFirehoseProducerWorker.MessageFactory<T> messageFactory)
-
-
Method Details
-
defaultConfigurator
-
produce
public void produce(io.aleph0.yap.core.Sink<Message<T>> sink) throws IOException, InterruptedException - Specified by:
producein interfaceio.aleph0.yap.core.ProducerWorker<T>- Throws:
IOExceptionInterruptedException
-
checkMetrics
- Specified by:
checkMetricsin interfaceio.aleph0.yap.core.Measureable<T>
-
flushMetrics
- Specified by:
flushMetricsin interfaceio.aleph0.yap.core.Measureable<T>
-