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

RPCMessage

class RPCMessage (source)

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

Constructors

<init>

Default constructor

RPCMessage(messageBytes: Bytes!)

Functions

asJSON

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

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

asString

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

fun asString(): String!

body

Provides the body of the message.

fun body(): Bytes!

bodyType

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

fun bodyType(): BodyType!

getErrorBody

Gets error body

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

getException

Gets exception from object mapper.

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

isErrorMessage

Returns true if this an error message.

fun isErrorMessage(): Boolean

isSuccessfulLastMessage

Returns true is this is the last message in the stream

fun isSuccessfulLastMessage(): Boolean

lastMessageOrError

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

fun lastMessageOrError(): Boolean

requestNumber

Provides the request number of the message.

fun requestNumber(): Int

rpcFlags

Provide the RPC flags set on the message.

fun rpcFlags(): Byte

stream

Indicates if the message is part of a stream.

fun stream(): Boolean