public class Image
extends java.lang.Object
Image from a publisher to a Subscription.
Each Image identifies a source publisher by session id.| Constructor and Description |
|---|
Image(Subscription subscription,
int sessionId,
org.agrona.concurrent.status.Position subscriberPosition,
LogBuffers logBuffers,
org.agrona.ErrorHandler errorHandler,
java.lang.String sourceIdentity,
long correlationId)
Construct a new image over a log to represent a stream of messages from a
Publication. |
| Modifier and Type | Method and Description |
|---|---|
int |
blockPoll(BlockHandler blockHandler,
int blockLengthLimit)
Poll for new messages in a stream.
|
int |
controlledPoll(ControlledFragmentHandler fragmentHandler,
int fragmentLimit)
Poll for new messages in a stream.
|
long |
correlationId()
The correlationId for identification of the image with the media driver.
|
java.nio.channels.FileChannel |
fileChannel()
The
FileChannel to the raw log of the Image. |
int |
initialTermId()
The initial term at which the stream started for this session.
|
boolean |
isClosed()
Has this object been closed and should no longer be used?
|
int |
poll(FragmentHandler fragmentHandler,
int fragmentLimit)
Poll for new messages in a stream.
|
long |
position()
The position this
Image has been consumed to by the subscriber. |
int |
rawPoll(RawBlockHandler rawBlockHandler,
int blockLengthLimit)
Poll for new messages in a stream.
|
int |
sessionId()
The sessionId for the steam of messages.
|
java.lang.String |
sourceIdentity()
The source identity of the sending publisher as an abstract concept appropriate for the media.
|
Subscription |
subscription()
Get the
Subscription to which this Image belongs. |
int |
termBufferLength()
Get the length in bytes for each term partition in the log buffer.
|
public Image(Subscription subscription, int sessionId, org.agrona.concurrent.status.Position subscriberPosition, LogBuffers logBuffers, org.agrona.ErrorHandler errorHandler, java.lang.String sourceIdentity, long correlationId)
Publication.subscription - to which this Image belongs.sessionId - of the stream of messages.subscriberPosition - for indicating the position of the subscriber in the stream.logBuffers - containing the stream of messages.errorHandler - to be called if an error occurs when polling for messages.sourceIdentity - of the source sending the stream of messages.correlationId - of the request to the media driver.public int termBufferLength()
public int sessionId()
public java.lang.String sourceIdentity()
public int initialTermId()
public long correlationId()
public Subscription subscription()
Subscription to which this Image belongs.Subscription to which this Image belongs.public boolean isClosed()
public long position()
Image has been consumed to by the subscriber.Image has been consumed to by the subscriber.public java.nio.channels.FileChannel fileChannel()
FileChannel to the raw log of the Image.FileChannel to the raw log of the Image.public int poll(FragmentHandler fragmentHandler, int fragmentLimit)
FragmentHandler up to a limited number of fragments as specified.
To assemble messages that span multiple fragments then use FragmentAssembler.fragmentHandler - to which message fragments are delivered.fragmentLimit - for the number of fragments to be consumed during one polling operation.FragmentAssemblerpublic int controlledPoll(ControlledFragmentHandler fragmentHandler, int fragmentLimit)
ControlledFragmentHandler up to a limited number of fragments as specified.
To assemble messages that span multiple fragments then use ControlledFragmentAssembler.fragmentHandler - to which message fragments are delivered.fragmentLimit - for the number of fragments to be consumed during one polling operation.ControlledFragmentAssemblerpublic int blockPoll(BlockHandler blockHandler, int blockLengthLimit)
BlockHandler up to a limited number of bytes.blockHandler - to which block is delivered.blockLengthLimit - up to which a block may be in length.public int rawPoll(RawBlockHandler rawBlockHandler, int blockLengthLimit)
RawBlockHandler up to a limited number of bytes.
This method is useful for operations like bulk archiving a stream to file.rawBlockHandler - to which block is delivered.blockLengthLimit - up to which a block may be in length.Copyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.