blpapi.TopicList
- class blpapi.TopicList(original=None)
A list of topics which require creation.
Contains a list of topics which require creation.
Created from topic strings or from
TOPIC_SUBSCRIBED
orRESOLUTION_SUCCESS
messages. This is passed to acreateTopics()
call orcreateTopicsAsync()
call on aProviderSession
. It is updated and returned by thecreateTopics()
call.- CREATED = 1
- FAILURE = 2
- NOT_CREATED = 0
- __init__(original=None)
Create an empty
TopicList
, or aTopicList
based onoriginal
ResolutionList
.- Parameters:
original – Original resolution list to use.
- Raises:
TypeError – If
original
is not an instance ofResolutionList
.
If
original
isNone
- create emptyTopicList
. Otherwise create aTopicList
fromoriginal
. In this caseoriginal
is used by handle, so if the caller modifies original resolution list after the call,TopicList
also changes because owns the same handle.
- add(topicOrMessage, correlationId=None)
Add the specified topic or topic from message to this
TopicList
.- Parameters:
topicOrMessage (
Union
[str
,Message
]) – Topic string or message to create a topic fromcorrelationId (
Optional
[CorrelationId
]) – CorrelationId to associate with the topic
- Return type:
- Returns:
0
on success or negative number on failure.- Raises:
TypeError – If
correlationId
is not an instance ofCorrelationId
.
If topic is passed as
topicOrMessage
, add the topic to this list, optionally specifying acorrelationId
. After a successful call toadd()
the status for this entry isNOT_CREATED
.If
Message
is passed astopicOrMessage
, add the topic contained in the specifiedtopicSubscribedMessage
orresolutionSuccessMessage
to this list, optionally specifying acorrelationId
. After a successful call toadd()
the status for this entry isNOT_CREATED
.
- correlationIdAt(index)
- message(correlationId)
- Parameters:
correlationId (
CorrelationId
) – Correlation id associated with the message- Return type:
- Returns:
Message received during creation of the topic identified by the specified
correlationId
.- Raises:
Exception – If
correlationId
does not identify an entry in thisTopicList
.
The message returned can be used when creating an instance of
Topic
.
- messageAt(index)
- Parameters:
index (
int
) – Index of the entry- Return type:
- Returns:
- Message received during creation of the entry at
index
.
- Raises:
Exception – If
index >= size()
.
The message returned can be used when creating an instance of
Topic
.
- status(correlationId)
- Parameters:
correlationId (
CorrelationId
) – Correlation id associated with the entry- Return type:
- Returns:
Status of the entry in this list identified by the specified
correlationId
. This may beNOT_CREATED
,CREATED
andFAILURE
.- Raises:
Exception – If the
correlationId
does not identify an entry in this list.
- statusAt(index)
- topicString(correlationId)
- Parameters:
correlationId (
CorrelationId
) – Correlation id associated with the topic.- Return type:
- Returns:
Topic of the entry identified by ‘correlationId’.
- Raises:
Exception – If the
correlationId
does not identify an entry in this list.