Record Class PipesMessage
java.lang.Object
java.lang.Record
org.apache.tika.pipes.core.protocol.PipesMessage
Uniform framed message for the PipesClient/PipesServer IPC protocol.
Wire format: [MAGIC 0x54 0x4B][TYPE 1B][LEN 4B][PAYLOAD]
- MAGIC — two bytes
0x54 0x4B("TK") for desync detection - TYPE — one byte identifying the
PipesMessageType - LEN — four-byte big-endian payload length (0 for empty payloads)
- PAYLOAD —
LENbytes of payload data
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum payload size: 100 MB (same as old MAX_FETCH_EMIT_TUPLE_BYTES). -
Constructor Summary
ConstructorsConstructorDescriptionPipesMessage(PipesMessageType type, byte[] payload) Creates an instance of aPipesMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic PipesMessageack()static PipesMessagecrash(PipesMessageType crashType, byte[] payload) final booleanIndicates whether some other object is "equal to" this one.static PipesMessagefinished(byte[] payload) final inthashCode()Returns a hash code value for this object.static PipesMessageintermediateResult(byte[] payload) longExtracts the last-progress timestamp from a WORKING message payload.static PipesMessagenewRequest(byte[] payload) byte[]payload()Returns the value of thepayloadrecord component.static PipesMessageping()static PipesMessageread(DataInputStream in) Reads one framed message from the stream.static PipesMessageready()static PipesMessageshutDown()static PipesMessagestartupFailed(byte[] payload) final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.static PipesMessageworking(long lastProgressMillis) Creates a WORKING heartbeat with the last-progress timestamp in the payload.voidwrite(DataOutputStream out) Writes this message to the stream and flushes.
-
Field Details
-
MAX_PAYLOAD_BYTES
public static final int MAX_PAYLOAD_BYTESMaximum payload size: 100 MB (same as old MAX_FETCH_EMIT_TUPLE_BYTES).- See Also:
-
-
Constructor Details
-
PipesMessage
Creates an instance of aPipesMessagerecord class.- Parameters:
type- the value for thetyperecord componentpayload- the value for thepayloadrecord component
-
-
Method Details
-
read
Reads one framed message from the stream.- Throws:
ProtocolDesyncException- if magic bytes don't matchEOFException- if the stream ends before a complete messageIOException- on payload size violations or I/O errors
-
write
Writes this message to the stream and flushes.- Throws:
IOException
-
ping
-
ack
-
ready
-
shutDown
-
working
Creates a WORKING heartbeat with the last-progress timestamp in the payload.- Parameters:
lastProgressMillis- epoch millis of the last progress update
-
newRequest
-
finished
-
intermediateResult
-
startupFailed
-
crash
-
lastProgressMillis
public long lastProgressMillis()Extracts the last-progress timestamp from a WORKING message payload.- Returns:
- epoch millis of the last progress update reported by the server
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
payload
public byte[] payload()Returns the value of thepayloadrecord component.- Returns:
- the value of the
payloadrecord component
-