Package io.elastic.api
Class Message
java.lang.Object
io.elastic.api.Message
- All Implemented Interfaces:
Serializable
Message to be processed by a
Function
. A message may have a body,
which represents a message's payload to be processed, and multiple attachments.
Both body and attachments are JsonObject
s.
A Function
may retrieve a value from Message
's body by a name,
as shown in the following example.
JsonArray orders = message.getBody().getJsonArray("orders");
A message is build using Message.Builder
, as shown in the following example.
JsonArray orders = JSON.parseArray(response.getOrders());
JsonObject body = Json.createObjectBuilder()
.add("orders", orders)
.build();
Message message = new Message.Builder().body(body).build();
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionjakarta.json.JsonObject
Returns message attachments.jakarta.json.JsonObject
getBody()
Returns message body.jakarta.json.JsonObject
Returns message headers.getId()
Returns message id.Returns message method.Returns message originalUrl.jakarta.json.JsonObject
Returns message passthrough.jakarta.json.JsonObject
getQuery()
Returns message query object.getUrl()
Returns message URL.jakarta.json.JsonObject
Returns this message asJsonObject
.toString()
-
Field Details
-
PROPERTY_ID
- See Also:
-
PROPERTY_ATTACHMENTS
- See Also:
-
PROPERTY_BODY
- See Also:
-
PROPERTY_HEADERS
- See Also:
-
PROPERTY_METHOD
- See Also:
-
PROPERTY_ORIGINAL_URL
- See Also:
-
PROPERTY_QUERY
- See Also:
-
PROPERTY_PASSTHROUGH
- See Also:
-
PROPERTY_URL
- See Also:
-
-
Method Details
-
getId
Returns message id.- Returns:
- id
-
getAttachments
public jakarta.json.JsonObject getAttachments()Returns message attachments.- Returns:
- attachments
-
getBody
public jakarta.json.JsonObject getBody()Returns message body.- Returns:
- body
-
getHeaders
public jakarta.json.JsonObject getHeaders()Returns message headers.- Returns:
- headers
-
getMethod
Returns message method.- Returns:
- method
-
getOriginalUrl
Returns message originalUrl.- Returns:
- originalUrl
-
getQuery
public jakarta.json.JsonObject getQuery()Returns message query object.- Returns:
- query
-
getPassthrough
public jakarta.json.JsonObject getPassthrough()Returns message passthrough.- Returns:
- passthrough
-
getUrl
Returns message URL.- Returns:
- url
-
toJsonObject
public jakarta.json.JsonObject toJsonObject()Returns this message asJsonObject
.- Returns:
- message as JSON object
-
toString
-