scuttlebutt-rpc / org.apache.tuweni.scuttlebutt.rpc / RPCMessage

RPCMessage

class RPCMessage (source)

Decoded RPC message, making elements of the message available directly.

Constructors

<init>

RPCMessage(messageBytes: Bytes)

Default constructor

Functions

asJSON

fun <T : Any> asJSON(objectMapper: ObjectMapper, clazz: Class<T>): T

Provides the body of the message, marshalled as a JSON object.

asString

fun asString(): String

Provides the body of the message as a UTF-8 string.

body

fun body(): Bytes

Provides the body of the message.

bodyType

fun bodyType(): BodyType

Provides the type of the body of the message: a binary message, a UTF-8 string or a JSON message.

getErrorBody

fun getErrorBody(objectMapper: ObjectMapper): Optional<RPCErrorBody>

getException

fun getException(objectMapper: ObjectMapper): Optional<RPCRequestFailedException>

isErrorMessage

fun isErrorMessage(): Boolean

isSuccessfulLastMessage

fun isSuccessfulLastMessage(): Boolean

lastMessageOrError

fun lastMessageOrError(): Boolean

Indicates if the message is either the last in the stream or an error message.

requestNumber

fun requestNumber(): Int

Provides the request number of the message.

rpcFlags

fun rpcFlags(): Byte

Provide the RPC flags set on the message.

stream

fun stream(): Boolean

Indicates if the message is part of a stream.