public interface ExcerptAppender extends ExcerptCommon<ExcerptAppender>, net.openhft.chronicle.wire.MarshallableOut
The component that facilitates sequentially writing data to a ChronicleQueue.
NOTE: Appenders are NOT thread-safe, sharing the Appender between threads will lead to errors and unpredictable behaviour.
| Modifier and Type | Method and Description |
|---|---|
int |
cycle()
Returns the cycle this appender is on.
|
long |
lastIndexAppended()
Returns the index last written.
|
default <T> T |
methodWriter(@NotNull Class<T> tClass,
Class... additional)
Creates and returns a new writer proxy for the given interface
tclass and the given additional
interfaces. |
default <T> @NotNull net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> |
methodWriterBuilder(@NotNull Class<T> tClass)
Creates and returns a new writer proxy for the given interface
tclass. |
default void |
normaliseEOFs()
Ensure all already-rolled cq4 files are correctly ended with EOF
Used by replication sinks on startup to cover off any edge cases where the replicated EOF was not received/applied
Can also be used on any appender, but this is not currently done automatically
|
default void |
pretouch()
Pre-touches storage resources for the current queue so that appenders
may exhibit more predictable latencies.
|
@Nullable net.openhft.chronicle.wire.Wire |
wire()
Returns a raw wire for low level direct access.
|
default void |
writeBytes(@NotNull net.openhft.chronicle.bytes.Bytes bytes)
Writes (i.e.
|
void |
writeBytes(@NotNull net.openhft.chronicle.bytes.BytesStore bytes)
Writes (i.e.
|
currentFile, disableThreadSafetyCheck, queue, sourceIdclose, closeQuietly, closeQuietly, notifyClosing, warnAndCloseIfNotClosedvoid writeBytes(@NotNull
@NotNull net.openhft.chronicle.bytes.BytesStore bytes)
bytes to the queue.bytes - to write to excerpt.net.openhft.chronicle.wire.UnrecoverableTimeoutException - if the operation times out.default void writeBytes(@NotNull
@NotNull net.openhft.chronicle.bytes.Bytes bytes)
bytes to the queue.bytes - to write to excerpt.net.openhft.chronicle.wire.UnrecoverableTimeoutException - if the operation times out.long lastIndexAppended()
The index includes the cycle and the sequence number.
IllegalStateException - if no index is availableint cycle()
Usually with chronicle-queue each cycle will have its own unique data file to store the excerpts
default void pretouch()
Pre-touching involves accessing pages of files/memory that are likely accessed in a near future and may also involve accessing/acquiring future cycle files.
We suggest this code is called from a background thread [ not you main business thread ], it must be called from the same thread that created it, as the call to pretouch() is not thread safe. For example :
newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> queue.acquireAppender().pretouch(), 0, 1, TimeUnit.SECONDS);
@NotNull
default <T> T methodWriter(@NotNull
@NotNull Class<T> tClass,
Class... additional)
tclass and the given additional
interfaces.
When methods are invoked on the returned T object, messages will be put in the queue.
Writers are NOT thread-safe. Sharing a Writer across threads will lead to errors and unpredictable behaviour.
methodWriter in interface net.openhft.chronicle.wire.MarshallableOutT - type parameter of the main interfacetClass - of the main interface to be implementedadditional - interfaces to be implementedtclass and the given additional
interfacesNullPointerException - if any of the provided parameters are null.@NotNull
default <T> @NotNull net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> methodWriterBuilder(@NotNull
@NotNull Class<T> tClass)
tclass.
When methods are invoked on the returned T object, messages will be put in the queue.
Writers are NOT thread-safe. Sharing a Writer across threads will lead to errors and unpredictable behaviour.
methodWriterBuilder in interface net.openhft.chronicle.wire.MarshallableOutT - type parameter of the main interfacetClass - of the main interface to be implementedtclassNullPointerException - if the provided parameter is null.@Nullable @Nullable net.openhft.chronicle.wire.Wire wire()
default void normaliseEOFs()
Copyright © 2022. All rights reserved.