Interface AQMessage
-
public interface AQMessage
A 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 ANYDATA
getANYDATAPayload()
Retrieves the payload as an ANYDATA.OracleJsonDatum
getJSONPayload()
Retrieves the payload as JSON type.byte[]
getMessageId()
Gets the id (16 bytes) of this message.AQMessageProperties
getMessageProperties()
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.RAW
getRAWPayload()
Retrieves the payload as a RAW.Struct
getStructPayload()
Retrieves the payload as java.sql.StructSTRUCT
getSTRUCTPayload()
Retrieves the payload as an ADT.oracle.xdb.XMLType
getXMLTypePayload()
Retrieves the payload as an XMLType.boolean
isANYDATAPayload()
Returns true if the payload type is ANYDATA and false otherwise.boolean
isJSONPayload()
Returns true if the payload type is JSON, false otherwise.boolean
isRAWPayload()
Returns trus if the payload type is RAW and false otherwise.boolean
isSTRUCTPayload()
Returns true if the payload is a STRUCT (in other words if the payload is an object) and false otherwise.boolean
isXMLTypePayload()
Returns trus if the payload type is XMLType and false otherwise.void
setPayload(byte[] payload)
Sets a RAW payload.void
setPayload(byte[] payload, byte[] tdo)
Sets the payload in its linearized form.void
setPayload(Struct payload)
Sets an ADT payload.void
setPayload(ANYDATA payload)
Sets an ANYDATA payload.void
setPayload(OracleJsonDatum jsonPayload)
Sets JSON type payload.void
setPayload(RAW payload)
Sets a RAW payload.void
setPayload(STRUCT payload)
Sets an ADT payload.void
setPayload(oracle.xdb.XMLType xmlt)
Sets an XMLType payload.String
toString()
Returns the String description of this message.
-
-
-
Method Detail
-
getMessageId
byte[] getMessageId() throws SQLException
Gets 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:
SQLException
-
getMessageProperties
AQMessageProperties getMessageProperties() throws SQLException
Gets the AQMessageProperties that goes with this AQMessage.- Throws:
SQLException
-
setPayload
void setPayload(byte[] payload) throws SQLException
Sets a RAW payload.Sets the payload 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:
SQLException
-
setPayload
void setPayload(byte[] payload, byte[] tdo) throws SQLException
Sets the payload in its linearized form.This method lets you set the payload in its linearized form. You need to provide the correpondant 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:
SQLException
-
setPayload
void setPayload(Struct payload) throws SQLException
Sets an ADT payload.- Throws:
SQLException
-
setPayload
void setPayload(STRUCT payload) throws SQLException
Sets an ADT payload.- Throws:
SQLException
-
setPayload
void setPayload(ANYDATA payload) throws SQLException
Sets an ANYDATA payload.- Throws:
SQLException
-
setPayload
void setPayload(RAW payload) throws SQLException
Sets a RAW payload.- Throws:
SQLException
-
setPayload
void setPayload(oracle.xdb.XMLType xmlt) throws SQLException
Sets an XMLType payload.- Throws:
SQLException
-
setPayload
void setPayload(OracleJsonDatum jsonPayload) throws SQLException
Sets JSON type payload.- Parameters:
jsonPayload
- json type payload.- Throws:
SQLException
-
getPayload
byte[] getPayload() throws SQLException
Retrieves the payload in its linearized form.- Throws:
SQLException
-
getPayloadTOID
byte[] getPayloadTOID()
Retrieves the TOID of the payload.
-
getSTRUCTPayload
STRUCT getSTRUCTPayload() throws SQLException
Retrieves the payload as an ADT.- Throws:
SQLException
-
getStructPayload
Struct getStructPayload() throws SQLException
Retrieves the payload as java.sql.Struct- Throws:
SQLException
-
isSTRUCTPayload
boolean isSTRUCTPayload() throws SQLException
Returns 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:
SQLException
-
getANYDATAPayload
ANYDATA getANYDATAPayload() throws SQLException
Retrieves the payload as an ANYDATA.- Throws:
SQLException
-
isANYDATAPayload
boolean isANYDATAPayload() throws SQLException
Returns 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:
SQLException
-
getRAWPayload
RAW getRAWPayload() throws SQLException
Retrieves the payload as a RAW.- Throws:
SQLException
-
isRAWPayload
boolean isRAWPayload() throws SQLException
Returns trus if the payload type is RAW and false otherwise.If the payload type is RAW, you should use
getRAWPayload()
to get its content.- Throws:
SQLException
-
getXMLTypePayload
oracle.xdb.XMLType getXMLTypePayload() throws SQLException
Retrieves the payload as an XMLType.- Throws:
SQLException
-
isXMLTypePayload
boolean isXMLTypePayload() throws SQLException
Returns trus if the payload type is XMLType and false otherwise.If the payload type is XMLType, you should use
getXMLTypePayload()
to get its content.- Throws:
SQLException
-
getJSONPayload
OracleJsonDatum getJSONPayload() throws SQLException
Retrieves the payload as JSON type.- Returns:
- JSON type payload
- Throws:
SQLException
-
isJSONPayload
boolean isJSONPayload() throws SQLException
Returns 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:
SQLException
-
-