28 #ifndef INCLUDED_BLPAPI_SESSION 29 #define INCLUDED_BLPAPI_SESSION 59 #ifndef INCLUDED_BLPAPI_ABSTRACTSESSION 63 #ifndef INCLUDED_BLPAPI_CALL 67 #ifndef INCLUDED_BLPAPI_CORRELATIONID 71 #ifndef INCLUDED_BLPAPI_DEFS 75 #ifndef INCLUDED_BLPAPI_EVENT 79 #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER 83 #ifndef INCLUDED_BLPAPI_IDENTITY 87 #ifndef INCLUDED_BLPAPI_REQUEST 91 #ifndef INCLUDED_BLPAPI_REQUESTTEMPLATE 95 #ifndef INCLUDED_BLPAPI_SERVICE 99 #ifndef INCLUDED_BLPAPI_SESSIONOPTIONS 103 #ifndef INCLUDED_BLPAPI_SUBSCRIPTIONLIST 107 #ifndef INCLUDED_BLPAPI_TYPES 121 const blpapi_CorrelationId_t *correlationId,
122 const char *subscriptionString,
124 const char *errorDescription,
151 unsigned int timeoutInMilliseconds);
161 const char *requestLabel,
162 int requestLabelLen);
168 const char *requestLabel,
176 const char *requestLabel,
177 int requestLabelLen);
182 const char *requestLabel,
190 int resubscriptionId,
191 const char *requestLabel,
192 int requestLabelLen);
197 int resubscriptionId,
198 const char *requestLabel,
206 const char *requestLabel,
207 int requestLabelLen);
211 const blpapi_CorrelationId_t *correlationIds,
212 size_t numCorrelationIds,
213 const char *requestLabel,
214 int requestLabelLen);
220 const blpapi_CorrelationId_t *correlationId);
225 blpapi_CorrelationId_t *correlationId,
228 const char *requestLabel,
229 int requestLabelLen);
234 blpapi_CorrelationId_t *correlationId);
240 const char *subscriptionString,
242 blpapi_CorrelationId_t *correlationId);
248 blpapi_CorrelationId_t *correlationId,
250 const char *requestLabel,
251 int requestLabelLen);
259 const char *serviceName,
260 blpapi_CorrelationId_t *correlationId);
264 blpapi_CorrelationId_t *correlationId,
270 const char *serviceName);
293 const char **subscriptionString,
294 blpapi_CorrelationId_t *correlationId,
306 #ifndef INCLUDED_CSTRING 308 #define INCLUDED_CSTRING 402 os <<
"InvalidSubscriptionString";
403 }
else if (error.
code 405 os <<
"CorrelationIdError";
410 os <<
"(" << error.
code <<
")";
411 os <<
", description: " << error.
description <<
"}";
417 const blpapi_CorrelationId_t *correlationId,
418 const char *subscriptionString,
420 const char *description,
423 typedef std::vector<SubscriptionPreprocessError> Errors;
424 Errors *errors = reinterpret_cast<Errors *>(userData);
425 errors->emplace_back(
426 *correlationId, subscriptionString, errorCode, description);
575 virtual bool start();
647 const char *requestLabel = 0,
648 int requestLabelLen = 0);
666 const char *requestLabel = 0,
667 int requestLabelLen = 0);
688 const char *requestLabel = 0,
689 int requestLabelLen = 0);
708 const char *requestLabel = 0,
709 int requestLabelLen = 0);
784 const char *requestLabel,
785 int requestLabelLen);
805 const char *requestLabel,
845 int resubscriptionId,
864 int resubscriptionId,
865 const char *requestLabel,
866 int requestLabelLen);
887 int resubscriptionId,
888 const char *requestLabel,
925 const char *requestLabel = 0,
926 int requestLabelLen = 0);
952 const char *requestLabel = 0,
953 int requestLabelLen = 0);
994 const char *subscriptionString,
1092 const char *d_subscriptionString;
1172 Session *session = reinterpret_cast<Session *>(userData);
1174 assert(session->d_eventHandler_p);
1185 : d_eventHandler_p(handler)
1187 if (dispatcher && !handler) {
1189 "Event dispatcher provided without handler.");
1193 dispatcher ? dispatcher->
impl() : 0,
1199 : d_handle_p(newHandle)
1228 d_handle_p, &event, static_cast<unsigned>(timeout)));
1229 return Event(event);
1239 *
event =
Event(impl);
1245 const char *requestLabel,
1246 int requestLabelLen)
1249 subscriptions.impl(),
1258 const char *requestLabel,
1259 int requestLabelLen)
1263 subscribe(subscriptions, requestLabel, requestLabelLen);
1267 subscriptions.impl(),
1280 const char *requestLabel,
1281 int requestLabelLen)
1284 subscriptions.impl(),
1294 const char *requestLabel,
1295 int requestLabelLen)
1299 subscribe(subscriptions, identity, requestLabel, requestLabelLen);
1303 subscriptions.impl(),
1317 subscriptions.impl(),
1332 subscriptions.impl(),
1343 const char *requestLabel,
1344 int requestLabelLen)
1347 d_handle_p, subscriptions.impl(), requestLabel, requestLabelLen));
1352 const char *requestLabel,
1353 int requestLabelLen,
1358 resubscribe(subscriptions, requestLabel, requestLabelLen);
1362 subscriptions.impl(),
1377 subscriptions.impl(),
1385 int resubscriptionId,
1394 subscriptions.impl(),
1406 int resubscriptionId,
1407 const char *requestLabel,
1408 int requestLabelLen)
1412 subscriptions.impl(),
1420 int resubscriptionId,
1421 const char *requestLabel,
1422 int requestLabelLen,
1434 subscriptions.impl(),
1455 d_handle_p, service.
handle(), 0, &correlationID.impl()));
1466 &correlationID.impl()));
1473 const char *requestLabel,
1474 int requestLabelLen)
1480 &retCorrelationId.impl(),
1482 eventQueue ? eventQueue->
handle() : 0,
1486 return retCorrelationId;
1492 const char *requestLabel,
1493 int requestLabelLen)
1499 &retCorrelationId.impl(),
1501 eventQueue ? eventQueue->
handle() : 0,
1505 return retCorrelationId;
1516 d_handle_p, requestTemplate.
impl(), &retCorrelationId.impl()));
1518 return retCorrelationId;
1522 const char *subscriptionString,
1533 const_cast<blpapi_CorrelationId_t *>(&correlationID.impl())));
1544 inline SubscriptionIterator::SubscriptionIterator(
Session *session)
1559 blpapi_CorrelationId_t nextCorrelationIdImpl;
1561 &d_subscriptionString,
1562 &nextCorrelationIdImpl,
1565 d_correlationId = d_isValid ?
CorrelationId(nextCorrelationIdImpl)
1584 return d_subscriptionString;
1593 return d_correlationId;
1603 return static_cast<Session::SubscriptionStatus>(d_status);
1609 #endif // ifdef __cplusplus 1611 #endif // INCLUDED_BLPAPI_SESSION struct blpapi_SubscriptionList blpapi_SubscriptionList_t
Definition: blpapi_subscriptionlist.h:224
struct blpapi_Identity blpapi_UserHandle_t
Definition: blpapi_types.h:185
#define BLPAPI_SUBSCRIPTIONSTATUS_UNSUBSCRIBED
Definition: blpapi_defs.h:103
int blpapi_Session_resubscribeWithIdEx(blpapi_Session_t *session, const blpapi_SubscriptionList_t *resubscriptionList, int resubscriptionId, const char *requestLabel, int requestLabelLen, blpapi_SubscriptionPreprocessErrorHandler_t errorHandler, void *userData)
#define BLPAPI_SUBSCRIPTIONPREPROCESS_CORRELATIONID_ERROR
Definition: blpapi_defs.h:161
bool isValid() const
Definition: blpapi_session.h:1571
blpapi_Identity_t * blpapi_Session_createIdentity(blpapi_Session_t *session)
virtual void subscribe(const SubscriptionList &subscriptionList, const Identity &identity, const char *requestLabel=0, int requestLabelLen=0)
Definition: blpapi_session.h:1278
blpapi_Request_t * handle() const
Definition: blpapi_request.h:712
int blpapi_Session_resubscribe(blpapi_Session_t *session, const blpapi_SubscriptionList_t *resubscriptionList, const char *requestLabel, int requestLabelLen)
struct blpapi_Request blpapi_Request_t
Definition: blpapi_request.h:67
Enum
Definition: blpapi_session.h:434
SubscriptionPreprocessError(const CorrelationId &correlationId, const std::string &subscriptionString, int code, const char *description)
Definition: blpapi_session.h:382
const char * subscriptionString() const
Definition: blpapi_session.h:1578
Common definitions used by the library.
No longer active, terminated by API.
Definition: blpapi_session.h:521
#define BLPAPI_SUBSCRIPTIONSTATUS_SUBSCRIBING
Definition: blpapi_defs.h:104
struct blpapi_Event blpapi_Event_t
Definition: blpapi_types.h:139
blpapi_EventQueue_t * handle() const
Definition: blpapi_event.h:583
Definition: blpapi_session.h:1089
#define BLPAPI_SUBSCRIPTIONSTATUS_CANCELLED
Definition: blpapi_defs.h:106
Updates are flowing.
Definition: blpapi_session.h:525
Definition: blpapi_abstractsession.h:220
virtual void stop()
Definition: blpapi_session.h:1216
#define BLPAPI_CALL(FUNCNAME)
Definition: blpapi_call.h:353
Definition: blpapi_service.h:304
int blpapi_Session_startAsync(blpapi_Session_t *session)
Initiated but no updates received.
Definition: blpapi_session.h:523
blpapi_SessionOptions_t * handle() const
Definition: blpapi_sessionoptions.h:1398
virtual bool start()
Definition: blpapi_session.h:1206
Definition: blpapi_session.h:443
Definition: blpapi_session.h:436
#define BLPAPI_SUBSCRIPTIONPREPROCESS_INVALID_SUBSCRIPTION_STRING
Definition: blpapi_defs.h:160
void blpapi_SubscriptionPreprocess_handleError(const blpapi_CorrelationId_t *correlationId, const char *subscriptionString, int errorCode, const char *description, void *userData)
Definition: blpapi_session.h:416
::BloombergLP::blpapi::EventHandler EventHandler
Definition: blpapi_session.h:503
Definition: blpapi_abstractsession.h:286
int blpapi_Session_stopAsync(blpapi_Session_t *session)
#define BLPAPI_ERROR_ILLEGAL_STATE
Definition: blpapi_error.h:74
int blpapi_Session_nextEvent(blpapi_Session_t *session, blpapi_Event_t **eventPointer, unsigned int timeoutInMilliseconds)
Definition: blpapi_session.h:366
int blpapi_Session_openServiceAsync(blpapi_Session_t *session, const char *serviceName, blpapi_CorrelationId_t *correlationId)
blpapi_Service_t * handle() const
Definition: blpapi_service.h:706
blpapi_AbstractSession_t * blpapi_Session_getAbstractSession(blpapi_Session_t *session)
Definition: blpapi_event.h:386
Definition: blpapi_requesttemplate.h:131
virtual ~EventHandler()=0
Definition: blpapi_session.h:1166
CorrelationId correlationId
Definition: blpapi_session.h:374
int blpapi_Session_sendRequestTemplate(blpapi_Session_t *session, const blpapi_RequestTemplate_t *requestTemplate, blpapi_CorrelationId_t *correlationId)
int blpapi_SubscriptionItr_isValid(const blpapi_SubscriptionIterator_t *iterator)
Provide access to the entitlements for a user.
void blpapi_SubscriptionItr_destroy(blpapi_SubscriptionIterator_t *iterator)
A service which provides access to API data (provide or consume).
int blpapi_Session_openService(blpapi_Session_t *session, const char *serviceName)
A component which defines events related operations.
int blpapi_Session_createSnapshotRequestTemplate(blpapi_RequestTemplate_t **requestTemplate, blpapi_Session_t *session, const char *subscriptionString, const blpapi_Identity_t *identity, blpapi_CorrelationId_t *correlationId)
void blpapi_Session_destroy(blpapi_Session_t *session)
Provide a key to identify individual subscriptions or requests.
struct blpapi_EventQueue blpapi_EventQueue_t
Definition: blpapi_types.h:148
Definition: blpapi_request.h:145
static void throwOnError(int errorCode)
Definition: blpapi_exception.h:526
#define BLPAPI_SUBSCRIPTIONSTATUS_PENDING_CANCELLATION
Definition: blpapi_defs.h:107
int blpapi_Session_unsubscribe(blpapi_Session_t *session, const blpapi_SubscriptionList_t *unsubscriptionList, const char *requestLabel, int requestLabelLen)
const blpapi_RequestTemplate_t * impl() const
Definition: blpapi_requesttemplate.h:224
blpapi_SubscriptionIterator_t * blpapi_SubscriptionItr_create(blpapi_Session_t *session)
Defines a request which can be sent for a service.
Definition: blpapi_session.h:429
Definition: blpapi_session.h:500
std::string subscriptionString
Definition: blpapi_session.h:375
int blpapi_Session_subscribeEx(blpapi_Session_t *session, const blpapi_SubscriptionList_t *subscriptionList, const blpapi_Identity_t *handle, const char *requestLabel, int requestLabelLen, blpapi_SubscriptionPreprocessErrorHandler_t errorHandler, void *userData)
Definition: blpapi_session.h:529
struct blpapi_Identity blpapi_Identity_t
Definition: blpapi_types.h:188
struct blpapi_EventDispatcher blpapi_EventDispatcher_t
Definition: blpapi_types.h:142
Definition: blpapi_session.h:360
blpapi_Session_t * handle() const
Definition: blpapi_session.h:1538
virtual ~Session()
Definition: blpapi_session.h:1204
#define BLPAPI_CALL_SESSION_RESUBSCRIBEWITHID(a1, a2, a3, a4, a5)
Definition: blpapi_call.h:406
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition: blpapi_correlationid.h:592
Definition: blpapi_correlationid.h:201
Definition: blpapi_subscriptionlist.h:314
Definition: blpapi_eventdispatcher.h:116
virtual bool startAsync()
Definition: blpapi_session.h:1211
Provide a dispatcher to dispatch events.
friend void blpapi_eventHandlerAdapter(blpapi_Event_t *event, blpapi_Session_t *, void *userData)
Definition: blpapi_session.h:1169
~SubscriptionIterator()
Definition: blpapi_session.h:1552
virtual void resubscribe(const SubscriptionList &subscriptions)
Definition: blpapi_session.h:1314
void(* blpapi_SubscriptionPreprocessErrorHandler_t)(const blpapi_CorrelationId_t *correlationId, const char *subscriptionString, int errorCode, const char *errorDescription, void *userData)
Definition: blpapi_session.h:120
virtual RequestTemplate createSnapshotRequestTemplate(const char *subscriptionString, const CorrelationId &statusCid, const Identity &identity=Identity())
Definition: blpapi_session.h:1521
Definition: blpapi_identity.h:131
int blpapi_Session_getService(blpapi_Session_t *session, blpapi_Service_t **service, const char *serviceName)
int blpapi_Session_setStatusCorrelationId(blpapi_Session_t *session, const blpapi_Service_t *service, const blpapi_Identity_t *identity, const blpapi_CorrelationId_t *correlationId)
void(* blpapi_EventHandler_t)(blpapi_Event_t *event, blpapi_Session_t *session, void *userData)
Definition: blpapi_session.h:117
const CorrelationId & correlationId() const
Definition: blpapi_session.h:1587
struct blpapi_RequestTemplate blpapi_RequestTemplate_t
Definition: blpapi_types.h:163
virtual int tryNextEvent(Event *event)
Definition: blpapi_session.h:1232
int blpapi_Session_cancel(blpapi_Session_t *session, const blpapi_CorrelationId_t *correlationIds, size_t numCorrelationIds, const char *requestLabel, int requestLabelLen)
int blpapi_Session_stop(blpapi_Session_t *session)
SubscriptionStatus
Definition: blpapi_session.h:520
struct blpapi_SubscriptionItrerator blpapi_SubscriptionIterator_t
Definition: blpapi_types.h:181
int code
Definition: blpapi_session.h:376
blpapi_Session_t * blpapi_Session_create(blpapi_SessionOptions_t *parameters, blpapi_EventHandler_t handler, blpapi_EventDispatcher_t *dispatcher, void *userData)
Definition: blpapi_event.h:196
blpapi_SubscriptionIterator_t * handle() const
Definition: blpapi_session.h:1573
int blpapi_Session_tryNextEvent(blpapi_Session_t *session, blpapi_Event_t **eventPointer)
No longer active, terminated by Application.
Definition: blpapi_session.h:527
Definition: blpapi_session.h:334
struct blpapi_AbstractSession blpapi_AbstractSession_t
Definition: blpapi_types.h:127
struct blpapi_Session blpapi_Session_t
Definition: blpapi_types.h:169
virtual void stopAsync()
Definition: blpapi_session.h:1218
int blpapi_Session_resubscribeWithId(blpapi_Session_t *session, const blpapi_SubscriptionList_t *resubscriptionList, int resubscriptionId, const char *requestLabel, int requestLabelLen)
int blpapi_Session_start(blpapi_Session_t *session)
virtual void unsubscribe(const SubscriptionList &subscriptionList)
Definition: blpapi_session.h:1445
virtual void setStatusCorrelationId(const Service &service, const CorrelationId &correlationID)
Definition: blpapi_session.h:1451
bool next()
Definition: blpapi_session.h:1557
Code
Definition: blpapi_session.h:361
A common interface shared between publish and consumer sessions.
Invalid subscription string.
Definition: blpapi_session.h:362
#define BLPAPI_EXPORT
Definition: blpapi_defs.h:171
struct blpapi_Service blpapi_Service_t
Definition: blpapi_types.h:166
int blpapi_Session_resubscribeEx(blpapi_Session_t *session, const blpapi_SubscriptionList_t *resubscriptionList, const char *requestLabel, int requestLabelLen, blpapi_SubscriptionPreprocessErrorHandler_t errorHandler, void *userData)
struct blpapi_SessionOptions blpapi_SessionOptions_t
Definition: blpapi_types.h:172
Provide functions for dispatchtbl.
virtual CorrelationId sendRequest(const Request &request, const CorrelationId &correlationId=CorrelationId(), EventQueue *eventQueue=0, const char *requestLabel=0, int requestLabelLen=0)
Definition: blpapi_session.h:1489
Provide a list of subscriptions.
int blpapi_Session_sendRequest(blpapi_Session_t *session, const blpapi_Request_t *request, blpapi_CorrelationId_t *correlationId, blpapi_Identity_t *identity, blpapi_EventQueue_t *eventQueue, const char *requestLabel, int requestLabelLen)
Definition: blpapi_exception.h:238
Provide a handle for a request template.
int blpapi_Session_generateToken(blpapi_Session_t *session, blpapi_CorrelationId_t *correlationId, blpapi_EventQueue_t *eventQueue)
blpapi_Identity_t * handle() const
Definition: blpapi_identity.h:381
void blpapi_eventHandlerAdapter(blpapi_Event_t *event, blpapi_Session_t *, void *userData)
Definition: blpapi_session.h:1169
Definition: blpapi_sessionoptions.h:431
blpapi_EventDispatcher_t * impl() const
Definition: blpapi_eventdispatcher.h:198
int blpapi_Session_sendAuthorizationRequest(blpapi_Session_t *session, const blpapi_Request_t *request, blpapi_Identity_t *identity, blpapi_CorrelationId_t *correlationId, blpapi_EventQueue_t *eventQueue, const char *requestLabel, int requestLabelLen)
int blpapi_SubscriptionItr_next(blpapi_SubscriptionIterator_t *iterator, const char **subscriptionString, blpapi_CorrelationId_t *correlationId, int *status)
Session::SubscriptionStatus subscriptionStatus() const
Definition: blpapi_session.h:1597
virtual Event nextEvent(int timeout=0)
Definition: blpapi_session.h:1220
#define BLPAPI_SUBSCRIPTIONSTATUS_SUBSCRIBED
Definition: blpapi_defs.h:105
std::vector< SubscriptionPreprocessError > SubscriptionPreprocessErrors
Definition: blpapi_session.h:451
A common interface shared between publisher and consumer sessions.
blpapi_UserHandle_t * blpapi_Session_createUserHandle(blpapi_Session_t *session)
std::string description
Definition: blpapi_session.h:380
int blpapi_Session_subscribe(blpapi_Session_t *session, const blpapi_SubscriptionList_t *subscriptionList, const blpapi_Identity_t *handle, const char *requestLabel, int requestLabelLen)
virtual bool processEvent(const Event &event, Session *session)=0