Interface AQMessage
-
public interface AQMessageA message is the unit that is enqueued or dequeued. An AQMessage object holds both its content, or payload, and its properties. This class provides methods to get and set message properties and the payload.- See Also:
AQFactory.createAQMessage
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ANYDATAgetANYDATAPayload()Retrieves the payload as an ANYDATA.OracleJsonDatumgetJSONPayload()Retrieves the payload as JSON type.byte[]getMessageId()Gets the id (16 bytes) of this message.AQMessagePropertiesgetMessageProperties()Gets the AQMessageProperties that goes with this AQMessage.byte[]getPayload()Retrieves the payload in its linearized form.byte[]getPayloadTOID()Retrieves the TOID of the payload.RAWgetRAWPayload()Retrieves the payload as a RAW.java.sql.StructgetStructPayload()java.sql.StructgetStructPayload(java.sql.Connection conn)Retrieves the payload as java.sql.StructSTRUCTgetSTRUCTPayload()Retrieves the payload as an ADT.STRUCTgetSTRUCTPayload(java.sql.Connection conn)oracle.xdb.XMLTypegetXMLTypePayload()Retrieves the payload as an XMLType.booleanisANYDATAPayload()Returns true if the payload type is ANYDATA and false otherwise.booleanisJSONPayload()Returns true if the payload type is JSON, false otherwise.booleanisRAWPayload()Returns true if the payload type is RAW and false otherwise.booleanisSTRUCTPayload()Returns true if the payload is a STRUCT (in other words if the payload is an object) and false otherwise.booleanisXMLTypePayload()Returns true if the payload type is XMLType and false otherwise.voidsetPayload(byte[] payload)Sets a RAW payload.voidsetPayload(byte[] payload, byte[] tdo)Sets the payload in its linearized form.voidsetPayload(java.sql.Struct payload)Sets an ADT payload.voidsetPayload(ANYDATA payload)Sets an ANYDATA payload.voidsetPayload(OracleJsonDatum jsonPayload)Sets JSON type payload.voidsetPayload(RAW payload)Sets a RAW payload.voidsetPayload(STRUCT payload)Sets an ADT payload.voidsetPayload(oracle.xdb.XMLType xmlt)Sets an XMLType payload.java.lang.StringtoString()Returns the String description of this message.
-
-
-
Method Detail
-
getMessageId
byte[] getMessageId() throws java.sql.SQLExceptionGets the id (16 bytes) of this message.There are enqueue and dequeue options to retrieve the id of a message after enqueue or dequeue.
- Throws:
java.sql.SQLException
-
getMessageProperties
AQMessageProperties getMessageProperties() throws java.sql.SQLException
Gets the AQMessageProperties that goes with this AQMessage.- Throws:
java.sql.SQLException
-
setPayload
void setPayload(byte[] payload) throws java.sql.SQLExceptionSets a RAW payload.Sets the payload type to "RAW" and stores the given payload but doesn't make a copy.
Calling this method is the equivalent of:
// payloadInBytes being the byte[] array RAW rawPayload = new RAW(payloadInBytes); message.setPayload(rawPayload);- Throws:
java.sql.SQLException
-
setPayload
void setPayload(byte[] payload, byte[] tdo) throws java.sql.SQLExceptionSets the payload in its linearized form.This method lets you set the payload in its linearized form. You need to provide the correponding OID of the Type Descriptor Object. This is useful in the case where you have your own pickler.
For example, given that the linearized form of a RAW instance is the bytes themselves, the following code:
message.setPayload(payloadInBytes);
is the same asmessage.setPayload(payloadInBytes,TypeDescriptor.RAWTOID);
- Throws:
java.sql.SQLException
-
setPayload
void setPayload(java.sql.Struct payload) throws java.sql.SQLExceptionSets an ADT payload.- Throws:
java.sql.SQLException
-
setPayload
void setPayload(STRUCT payload) throws java.sql.SQLException
Sets an ADT payload.- Throws:
java.sql.SQLException
-
setPayload
void setPayload(ANYDATA payload) throws java.sql.SQLException
Sets an ANYDATA payload.- Throws:
java.sql.SQLException
-
setPayload
void setPayload(RAW payload) throws java.sql.SQLException
Sets a RAW payload.- Throws:
java.sql.SQLException
-
setPayload
void setPayload(oracle.xdb.XMLType xmlt) throws java.sql.SQLExceptionSets an XMLType payload.- Throws:
java.sql.SQLException
-
setPayload
void setPayload(OracleJsonDatum jsonPayload) throws java.sql.SQLException
Sets JSON type payload.- Parameters:
jsonPayload- json type payload.- Throws:
java.sql.SQLException
-
getPayload
byte[] getPayload() throws java.sql.SQLExceptionRetrieves the payload in its linearized form.- Throws:
java.sql.SQLException
-
getPayloadTOID
byte[] getPayloadTOID()
Retrieves the TOID of the payload.
-
getSTRUCTPayload
STRUCT getSTRUCTPayload() throws java.sql.SQLException
Retrieves the payload as an ADT.- Throws:
java.sql.SQLException
-
getSTRUCTPayload
STRUCT getSTRUCTPayload(java.sql.Connection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getStructPayload
java.sql.Struct getStructPayload(java.sql.Connection conn) throws java.sql.SQLExceptionRetrieves the payload as java.sql.Struct- Throws:
java.sql.SQLException
-
getStructPayload
java.sql.Struct getStructPayload() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
isSTRUCTPayload
boolean isSTRUCTPayload() throws java.sql.SQLExceptionReturns true if the payload is a STRUCT (in other words if the payload is an object) and false otherwise.If the payload is q STRUCT, you should use
getSTRUCTPayload()to get its value.- Throws:
java.sql.SQLException
-
getANYDATAPayload
ANYDATA getANYDATAPayload() throws java.sql.SQLException
Retrieves the payload as an ANYDATA.- Throws:
java.sql.SQLException
-
isANYDATAPayload
boolean isANYDATAPayload() throws java.sql.SQLExceptionReturns true if the payload type is ANYDATA and false otherwise.If the payload type is ANYDATA, you should use
getANYDATAPayload()to get its content.- Throws:
java.sql.SQLException
-
getRAWPayload
RAW getRAWPayload() throws java.sql.SQLException
Retrieves the payload as a RAW.- Throws:
java.sql.SQLException
-
isRAWPayload
boolean isRAWPayload() throws java.sql.SQLExceptionReturns true if the payload type is RAW and false otherwise.If the payload type is RAW, you should use
getRAWPayload()to get its content.- Throws:
java.sql.SQLException
-
getXMLTypePayload
oracle.xdb.XMLType getXMLTypePayload() throws java.sql.SQLExceptionRetrieves the payload as an XMLType.- Throws:
java.sql.SQLException
-
isXMLTypePayload
boolean isXMLTypePayload() throws java.sql.SQLExceptionReturns true if the payload type is XMLType and false otherwise.If the payload type is XMLType, you should use
getXMLTypePayload()to get its content.- Throws:
java.sql.SQLException
-
getJSONPayload
OracleJsonDatum getJSONPayload() throws java.sql.SQLException
Retrieves the payload as JSON type.- Returns:
- JSON type payload
- Throws:
java.sql.SQLException
-
isJSONPayload
boolean isJSONPayload() throws java.sql.SQLExceptionReturns true if the payload type is JSON, false otherwise.If the payload type is JSON, you should use
getJSONPayload()to get its content.- Returns:
- true if the payload type is JSON, false otherwise.
- Throws:
java.sql.SQLException
-
toString
java.lang.String toString()
Returns the String description of this message.- Overrides:
toStringin classjava.lang.Object
-
-