|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bloomberglp.blpapi.Message
public abstract class Message
Message objects are used to represent all outputs from the API
Message objects are used to represent all outputs from the API including
subscription data, response, administrative and status messages. Message
objects are obtained from a MessageIterator
. A message always has
a message type and may optionally contain the following
* topicName - valid for Subscription data messages * service - The service from which this message was received from * correlationId - one or more correlationIds if this message was delivered for a pending request or a subscription
A Message object is a handle to a single underlying protocol message. The Message contents are represented as an Element and some convenient shortcuts are supplied to the Element accessors.
Nested Class Summary | |
---|---|
static class |
Message.Fragment
A message could be split into more than one fragments to reduce each message size. |
Method Summary | |
---|---|
abstract Element |
asElement()
Returns the contents of this Message as a read-only Element . |
abstract CorrelationID |
correlationID()
Return the correlationId associated with this message. |
abstract CorrelationID |
correlationID(int index)
Return the correlationId associated with this message at the specified index |
abstract CorrelationID |
correlationIDAt(int index)
Deprecated. As of 3.2.1, use correlationID(int) |
abstract Message.Fragment |
fragmentType()
Return the fragment type. |
abstract Element |
getElement(Name name)
Return the element of this message having the specified name. |
abstract Element |
getElement(java.lang.String name)
Return the element of this message having the specified name. |
abstract boolean |
getElementAsBool(Name name)
Return the value of the element having specified name as a boolean value |
abstract boolean |
getElementAsBool(java.lang.String name)
Return the value of the element having specified name as a boolean value |
abstract byte[] |
getElementAsBytes(Name name)
Return the value of the element having specified name as a byte array |
abstract byte[] |
getElementAsBytes(java.lang.String name)
Return the value of the element having specified name as a byte array |
abstract char |
getElementAsChar(Name name)
Return the value of the element having specified name as a char value |
abstract char |
getElementAsChar(java.lang.String name)
Return the value of the element having specified name as a char value |
abstract Datetime |
getElementAsDate(Name name)
Return the value of the element having specified name as a Date value |
abstract Datetime |
getElementAsDate(java.lang.String name)
Return the value of the element having specified name as a Date value |
abstract Datetime |
getElementAsDatetime(Name name)
Return the value of the element having specified name as a Datetime value |
abstract Datetime |
getElementAsDatetime(java.lang.String name)
Return the value of the element having specified name as a Datetime value |
abstract float |
getElementAsFloat32(Name name)
Return the value of the element having specified name as a float value |
abstract float |
getElementAsFloat32(java.lang.String name)
Return the value of the element having specified name as a float value |
abstract double |
getElementAsFloat64(Name name)
Return the value of the element having specified name as a double value |
abstract double |
getElementAsFloat64(java.lang.String name)
Return the value of the element having specified name as a double value |
abstract int |
getElementAsInt32(Name name)
Return the value of the element having specified name as a int value |
abstract int |
getElementAsInt32(java.lang.String name)
Return the value of the element having specified name as a int value |
abstract long |
getElementAsInt64(Name name)
Return the value of the element having specified name as a long value |
abstract long |
getElementAsInt64(java.lang.String name)
Return the value of the element having specified name as a long value |
abstract Name |
getElementAsName(Name name)
Return the value of the element having specified name as a Constant value |
abstract Name |
getElementAsName(java.lang.String name)
Return the value of the element having specified name as a Constant value |
abstract java.lang.String |
getElementAsString(Name name)
Return the value of the element having specified name as a String value |
abstract java.lang.String |
getElementAsString(java.lang.String name)
Return the value of the element having specified name as a String value |
abstract Datetime |
getElementAsTime(Name name)
Return the value of the element having specified name as a Time value |
abstract Datetime |
getElementAsTime(java.lang.String name)
Return the value of the element having specified name as a Time value |
abstract boolean |
hasElement(Name name)
Return true if this message has the element having the specified name false otherwise |
abstract boolean |
hasElement(Name name,
boolean excludeNullElements)
Return true if this message has the element having the specified name false otherwise |
abstract boolean |
hasElement(java.lang.String name)
Return true if this message has the element having the specified name false otherwise |
abstract boolean |
hasElement(java.lang.String name,
boolean excludeNullElements)
Return true if this message has the element having the specified name false otherwise |
abstract boolean |
isValid()
|
abstract Name |
messageType()
Return the Name constant representing the type of the message |
abstract int |
numCorrelationIds()
Return the number of correlation ids associated with this message. |
abstract int |
numElements()
Return the number of elements contained by this message |
abstract void |
print(java.io.OutputStream output)
Prints the contents of this message to OutputStream. |
abstract void |
print(java.io.Writer writer)
Prints the contents of this message to Writer. |
abstract Service |
service()
Return the Service associated with this message. |
abstract long |
timeReceivedMillis()
Return the time when the message was received by the SDK and '0' if there is no timestamp associated with this Message. |
abstract java.lang.String |
topicName()
Return the topic string associated with this message. |
abstract java.lang.String |
toString()
Returns the contents of this message as a String |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public abstract java.lang.String topicName()
public abstract Service service()
public abstract Name messageType()
public abstract Message.Fragment fragmentType()
public abstract CorrelationID correlationID()
This is same as calling correlationID(0)
.
If there is more than one correlationId associated with this message
return the first correlationId. If there are no correlationIds available
for this message return null
public abstract CorrelationID correlationIDAt(int index)
correlationID(int)
public abstract CorrelationID correlationID(int index)
Normally each message is associated with only one correlationId. See
"allowMultipeCorrelatorsPerMsg" option in SessionOptions
for
more information on when multiple correlators can be returned per
message
java.lang.IndexOutOfBoundsException
- if
index >= numCorrelationIds()
public abstract int numCorrelationIds()
Note: A Message will have exactly one CorrelationId unless "allowMultipleCorrelatorsPerMsg" option was enabled for the Session this Message came from. When allowMultipleCorrelatorsPerMsg is disabled (the default) and more than one active subscription would result in the same Message the Message is delivered multiple times (without making a physical copy). Each Message is accompanied by a single CorrelationId. When "allowMultipleCorrelatorsPerMsg" is enabled and more than one active subscription would result in the same Message the Message is delivered once with a list of corresponding CorrelationId values.
SessionOptions
public abstract long timeReceivedMillis()
System.currentTimeMillis()
is used to get the current
time. Note that by default the subscription data messages are not
timestamped (but all the other messages are). To enable recording
receive time for all messages set
SessionOptions.setRecordSubscriptionDataReceiveTimes(boolean)
.
public abstract Element asElement()
Element
.
public abstract int numElements()
Same as calling asElement()
.Element.numElements()
public abstract boolean isValid()
public abstract boolean hasElement(Name name)
Same as calling asElement()
.Element.hasElement(Name)
public abstract boolean hasElement(Name name, boolean excludeNullElements)
Same as calling
asElement()
.Element.hasElement(Name, boolean)
public abstract boolean hasElement(java.lang.String name)
Same as calling asElement()
.Element.hasElement(String)
public abstract boolean hasElement(java.lang.String name, boolean excludeNullElements)
Same as calling
asElement()
.Element.hasElement(String, boolean)
public abstract Element getElement(Name name)
Same as calling asElement()
.Element.getElement(Name)
NotFoundException
- if this message does not contain an element
having the specified namepublic abstract Element getElement(java.lang.String name)
Same as calling asElement()
.Element.getElement(String)
NotFoundException
- if this message does not contain an element
having the specified namepublic abstract boolean getElementAsBool(Name name)
Same as calling asElement()
.Element.getElementAsBool(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a boolean valuepublic abstract boolean getElementAsBool(java.lang.String name)
Same as calling asElement()
.Element.getElementAsBool(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a boolean valuepublic abstract byte[] getElementAsBytes(Name name)
Same as calling asElement()
.Element.getElementAsBytes(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a byte arraypublic abstract byte[] getElementAsBytes(java.lang.String name)
Same as calling asElement()
.Element.getElementAsBytes(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a byte arraypublic abstract char getElementAsChar(Name name)
Same as calling asElement()
.Element.getElementAsChar(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a char valuepublic abstract char getElementAsChar(java.lang.String name)
Same as calling asElement()
.Element.getElementAsChar(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a char valuepublic abstract int getElementAsInt32(Name name)
Same as calling asElement()
.Element.getElementAsInt32(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a int valuepublic abstract int getElementAsInt32(java.lang.String name)
Same as calling asElement()
.Element.getElementAsInt32(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a int valuepublic abstract long getElementAsInt64(Name name)
Same as calling asElement()
.Element.getElementAsInt64(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a long valuepublic abstract long getElementAsInt64(java.lang.String name)
Same as calling asElement()
.Element.getElementAsInt64(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a long valuepublic abstract double getElementAsFloat64(Name name)
Same as calling asElement()
.Element.getElementAsFloat64(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a double valuepublic abstract double getElementAsFloat64(java.lang.String name)
Same as calling asElement()
.Element.getElementAsFloat64(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a double valuepublic abstract float getElementAsFloat32(Name name)
Same as calling asElement()
.Element.getElementAsFloat32(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a float valuepublic abstract float getElementAsFloat32(java.lang.String name)
Same as calling asElement()
.Element.getElementAsFloat32(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a float valuepublic abstract java.lang.String getElementAsString(Name name)
Same as calling asElement()
.Element.getElementAsString(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a String valuepublic abstract java.lang.String getElementAsString(java.lang.String name)
Same as calling asElement()
.Element.getElementAsString(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a String valuepublic abstract Datetime getElementAsDatetime(Name name)
Same as calling asElement()
.Element.getElementAsDatetime(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Datetime valuepublic abstract Datetime getElementAsDatetime(java.lang.String name)
Same as calling asElement()
.Element.getElementAsDatetime(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Datetime valuepublic abstract Datetime getElementAsDate(Name name)
Same as calling asElement()
.Element.getElementAsDate(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Date valuepublic abstract Datetime getElementAsDate(java.lang.String name)
Same as calling asElement()
.Element.getElementAsDate(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Date valuepublic abstract Datetime getElementAsTime(Name name)
Same as calling asElement()
.Element.getElementAsTime(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Time valuepublic abstract Datetime getElementAsTime(java.lang.String name)
Same as calling asElement()
.Element.getElementAsTime(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Time valuepublic abstract Name getElementAsName(Name name)
Same as calling asElement()
.Element.getElementAsName(Name)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Time valuepublic abstract Name getElementAsName(java.lang.String name)
Same as calling asElement()
.Element.getElementAsName(String)
NotFoundException
- if this message does not contain an element
having the specified name
InvalidConversionException
- if the value is not convertible to
a Time valuepublic abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract void print(java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public abstract void print(java.io.Writer writer) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |