Package trading.keysquare.api.message
Interface SbeMessage<E extends org.agrona.sbe.MessageEncoderFlyweight,D extends org.agrona.sbe.MessageDecoderFlyweight>
- All Superinterfaces:
KeyHeader,KeyMessage<D>,MutableKeyHeader<SbeMessage<E,,D>> MutableKeyMessage<D,SbeMessage<E, D>>
public interface SbeMessage<E extends org.agrona.sbe.MessageEncoderFlyweight,D extends org.agrona.sbe.MessageDecoderFlyweight>
extends MutableKeyMessage<D,SbeMessage<E,D>>
SBE message for publication.
Instances can be reused by replacing topic fields and payload before each publish.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFrom(KeyMessage<? extends org.agrona.sbe.MessageFlyweight> source) Copies the message fields and SBE payload from the given source message into this message.Returns the decoder wrapped over the current encoder payload.Returns the encoder assigned bypayloadEncoder(MessageEncoderFlyweight).SbeMessage<E, D> payloadEncoder(E encoder) Sets the SBE payload encoder for this message.intReturns the SBE message header encoded length used to locate payload bytes.SbeMessage<E, D> payloadHeaderEncodedLength(int headerEncodedLength) Sets the message header encoded length for this message.voidResets the encoder position before encoding messages with repeating groups or variable length data fields.Methods inherited from interface trading.keysquare.api.message.KeyHeader
applicationId, applicationSequenceNumber, cacheMode, causeSequenceNumber, editable, messageType, payloadSchemaId, payloadTemplateId, publicationNanoTime, relayNanoTime, sequenceNumber, sequencerNanoTime, topicGroup, topicId, topicSource, voidedMethods inherited from interface trading.keysquare.api.message.KeyMessage
payloadMethods inherited from interface trading.keysquare.api.message.MutableKeyHeader
cacheMode, causeSequenceNumber, editable, topic, topic, topicGroup, topicId, topicSource, voided
-
Method Details
-
payloadEncoder
Sets the SBE payload encoder for this message. The encoder must have been initialised viaencoder.wrapAndApplyHeader(buffer, offset, headerEncoder)before being passed here. At publish time, the encoder'sbuffer(),offset(), andencodedLength()are used to locate the payload bytes. -
payloadDecoder
D payloadDecoder()Returns the decoder wrapped over the current encoder payload. -
payloadEncoder
E payloadEncoder()Returns the encoder assigned bypayloadEncoder(MessageEncoderFlyweight). -
payloadHeaderEncodedLength
Sets the message header encoded length for this message. Use this when the payload uses a non-standard message header. When the message is created with a concrete encoder class, this is resolved automatically from the schema. -
payloadHeaderEncodedLength
int payloadHeaderEncodedLength()Returns the SBE message header encoded length used to locate payload bytes. -
prepareVariableLengthEncoder
void prepareVariableLengthEncoder()Resets the encoder position before encoding messages with repeating groups or variable length data fields. This is effectively the same as:
Envelope fields (topics, flags, etc.) are not affected.encoder.wrap(encoder.buffer(), headerEncodedLength); -
copyFrom
Copies the message fields and SBE payload from the given source message into this message. The source payload bytes are copied into an independent, heap-backed, expandable buffer. If the encoder already has a buffer with sufficient capacity, it is reused to avoid allocation. The encoder is wrapped on the copied buffer and is usable for further modifications after the copy.The source payload must be a
MessageDecoderFlyweightorMessageEncoderFlyweight.For widened messages created with
MessageEncoderFlyweight.class, assign a concrete encoder withpayloadEncoder(MessageEncoderFlyweight)before calling this method.
-