public class ServiceMessage
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NATS_SERVICE_ERROR
Standard header name used to report the text of an error
|
static java.lang.String |
NATS_SERVICE_ERROR_CODE
Standard header name used to report the code of an error
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getData()
the data from the message
|
io.nats.client.impl.Headers |
getHeaders()
the headers object for the message
|
java.lang.String |
getReplyTo()
the subject the application is expected to send a reply message on
|
java.lang.String |
getSubject()
the subject that this message was sent to
|
boolean |
hasHeaders()
true if there are headers
|
void |
respond(Connection conn,
byte[] response)
Respond to a service request message.
|
void |
respond(Connection conn,
byte[] response,
io.nats.client.impl.Headers headers)
Respond to a service request message with a response and custom headers.
|
void |
respond(Connection conn,
io.nats.client.support.JsonSerializable response)
Respond to a service request message.
|
void |
respond(Connection conn,
io.nats.client.support.JsonSerializable response,
io.nats.client.impl.Headers headers)
Respond to a service request message.
|
void |
respond(Connection conn,
java.lang.String response)
Respond to a service request message.
|
void |
respond(Connection conn,
java.lang.String response,
io.nats.client.impl.Headers headers)
Respond to a service request message with a response and custom headers.
|
void |
respondStandardError(Connection conn,
java.lang.String errorText,
int errorCode)
Respond to a service request message with a standard error.
|
public static final java.lang.String NATS_SERVICE_ERROR
public static final java.lang.String NATS_SERVICE_ERROR_CODE
public void respond(Connection conn, byte[] response)
conn - the NATS connectionresponse - the response payload in the form of a byte arraypublic void respond(Connection conn, java.lang.String response)
conn - the NATS connectionresponse - the response payload in the form of a stringpublic void respond(Connection conn, io.nats.client.support.JsonSerializable response)
conn - the NATS connectionresponse - the response payload in the form of a JsonSerializable objectpublic void respond(Connection conn, byte[] response, io.nats.client.impl.Headers headers)
conn - the NATS connectionresponse - the response payload in the form of a byte arrayheaders - the custom headerspublic void respond(Connection conn, java.lang.String response, io.nats.client.impl.Headers headers)
conn - the NATS connectionresponse - the response payload in the form of a stringheaders - the custom headerspublic void respond(Connection conn, io.nats.client.support.JsonSerializable response, io.nats.client.impl.Headers headers)
conn - the NATS connectionresponse - the response payload in the form of a JsonSerializable objectheaders - the custom headerspublic void respondStandardError(Connection conn, java.lang.String errorText, int errorCode)
conn - the NATS connectionerrorText - the error message texterrorCode - the error message codepublic java.lang.String getSubject()
public java.lang.String getReplyTo()
public boolean hasHeaders()
public io.nats.client.impl.Headers getHeaders()
public byte[] getData()