E - the type of stream elementpublic class RsPublisher<E> extends Object implements StreamPublisher
Streams as resultsets.| Constructor and Description |
|---|
RsPublisher(Stream<E> stream,
Generator<E,String> serialiser)
Creates an instance for a given
Stream and with a given element serialiser. |
RsPublisher(Stream<E> stream,
RecordFactory<E> factory)
Creates an instance for a given
Stream and with a given RecordFactory. |
| Modifier and Type | Method and Description |
|---|---|
URI |
publish()
Publishes the stream and returns its address.
|
void |
setBufferSize(int size)
Sets the size of the write buffer.
|
void |
setFaultHandler(FaultHandler handler)
Sets the
FaultHandler for reading and writing failures. |
void |
setOnDemand(boolean onDemand)
Sets the production mode of the publiher
|
void |
setThreadProvider(ThreadProvider provider)
Sets the
ThreadProvider used to populate the resultset. |
void |
setTimeout(long timeout,
TimeUnit timeoutUnit)
Sets the time to wait on a full write buffer.
|
void |
setTransport(RsTransport transport)
Sets the resultset transport.
|
public RsPublisher(Stream<E> stream, Generator<E,String> serialiser)
Stream and with a given element serialiser.stream - the streamserialiser - the serialiserpublic RsPublisher(Stream<E> stream, RecordFactory<E> factory)
Stream and with a given RecordFactory.stream - the streamfactory - the factorypublic void setBufferSize(int size)
throws IllegalArgumentException
size - the size in bytes.IllegalArgumentException - if the size is not a positive numberpublic void setTimeout(long timeout,
TimeUnit timeoutUnit)
throws IllegalArgumentException
timeout - the timeouttimeoutUnit - the timeout unitIllegalArgumentException - if the timeout is not a positive number or the timeout unit is nullpublic void setTransport(RsTransport transport)
transport - the transportIllegalArgumentException - if the transport is nullpublic void setOnDemand(boolean onDemand)
onDemand - true if the stream ought to be consumed only when clients require it,
false if it should be consumed continuously.public void setThreadProvider(ThreadProvider provider)
ThreadProvider used to populate the resultset.provider - the providerIllegalArgumentException - if the provider is null.public void setFaultHandler(FaultHandler handler)
FaultHandler for reading and writing failures.handler - the handlerIllegalArgumentException - if the handler is nullpublic URI publish() throws StreamPublishException
StreamPublisherpublish in interface StreamPublisherStreamPublishException - if the stream cannot be publishedCopyright © 2015. All Rights Reserved.