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);
577 virtual bool start();
649 const char *requestLabel = 0,
650 int requestLabelLen = 0);
668 const char *requestLabel = 0,
669 int requestLabelLen = 0);
690 const char *requestLabel = 0,
691 int requestLabelLen = 0);
710 const char *requestLabel = 0,
711 int requestLabelLen = 0);
786 const char *requestLabel,
787 int requestLabelLen);
807 const char *requestLabel,
847 int resubscriptionId,
866 int resubscriptionId,
867 const char *requestLabel,
868 int requestLabelLen);
889 int resubscriptionId,
890 const char *requestLabel,
927 const char *requestLabel = 0,
928 int requestLabelLen = 0);
954 const char *requestLabel = 0,
955 int requestLabelLen = 0);
996 const char *subscriptionString,
1094 const char *d_subscriptionString;
1174 Session *session = reinterpret_cast<Session *>(userData);
1176 assert(session->d_eventHandler_p);
1187 : d_eventHandler_p(handler)
1189 if (dispatcher && !handler) {
1191 "Event dispatcher provided without handler.");
1195 dispatcher ? dispatcher->
impl() : 0,
1201 : d_handle_p(newHandle)
1230 d_handle_p, &event, static_cast<unsigned>(timeout)));
1231 return Event(event);
1241 *
event =
Event(impl);
1247 const char *requestLabel,
1248 int requestLabelLen)
1251 subscriptions.impl(),
1260 const char *requestLabel,
1261 int requestLabelLen)
1265 subscribe(subscriptions, requestLabel, requestLabelLen);
1269 subscriptions.impl(),
1282 const char *requestLabel,
1283 int requestLabelLen)
1286 subscriptions.impl(),
1296 const char *requestLabel,
1297 int requestLabelLen)
1301 subscribe(subscriptions, identity, requestLabel, requestLabelLen);
1305 subscriptions.impl(),
1319 subscriptions.impl(),
1334 subscriptions.impl(),
1345 const char *requestLabel,
1346 int requestLabelLen)
1349 d_handle_p, subscriptions.impl(), requestLabel, requestLabelLen));
1354 const char *requestLabel,
1355 int requestLabelLen,
1360 resubscribe(subscriptions, requestLabel, requestLabelLen);
1364 subscriptions.impl(),
1379 subscriptions.impl(),
1387 int resubscriptionId,
1396 subscriptions.impl(),
1408 int resubscriptionId,
1409 const char *requestLabel,
1410 int requestLabelLen)
1414 subscriptions.impl(),
1422 int resubscriptionId,
1423 const char *requestLabel,
1424 int requestLabelLen,
1436 subscriptions.impl(),
1457 d_handle_p, service.
handle(), 0, &correlationID.impl()));
1468 &correlationID.impl()));
1475 const char *requestLabel,
1476 int requestLabelLen)
1482 &retCorrelationId.impl(),
1484 eventQueue ? eventQueue->
handle() : 0,
1488 return retCorrelationId;
1494 const char *requestLabel,
1495 int requestLabelLen)
1501 &retCorrelationId.impl(),
1503 eventQueue ? eventQueue->
handle() : 0,
1507 return retCorrelationId;
1518 d_handle_p, requestTemplate.
impl(), &retCorrelationId.impl()));
1520 return retCorrelationId;
1524 const char *subscriptionString,
1535 const_cast<blpapi_CorrelationId_t *>(&correlationID.impl())));
1546 inline SubscriptionIterator::SubscriptionIterator(
Session *session)
1561 blpapi_CorrelationId_t nextCorrelationIdImpl;
1563 &d_subscriptionString,
1564 &nextCorrelationIdImpl,
1567 d_correlationId = d_isValid ?
CorrelationId(nextCorrelationIdImpl)
1586 return d_subscriptionString;
1595 return d_correlationId;
1605 return static_cast<Session::SubscriptionStatus>(d_status);
1611 #endif // ifdef __cplusplus 1613 #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:1573
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:1280
blpapi_Request_t * handle() const
Definition: blpapi_request.h:733
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:68
Enum
Definition: blpapi_session.h:436
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:1580
Common definitions used by the library.
No longer active, terminated by API.
Definition: blpapi_session.h:523
#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:586
Definition: blpapi_session.h:1091
#define BLPAPI_SUBSCRIPTIONSTATUS_CANCELLED
Definition: blpapi_defs.h:106
Updates are flowing.
Definition: blpapi_session.h:527
Definition: blpapi_abstractsession.h:220
virtual void stop()
Definition: blpapi_session.h:1218
#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:525
blpapi_SessionOptions_t * handle() const
Definition: blpapi_sessionoptions.h:1401
virtual bool start()
Definition: blpapi_session.h:1208
Definition: blpapi_session.h:445
Definition: blpapi_session.h:438
#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:505
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:1168
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:146
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:431
Definition: blpapi_session.h:502
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:531
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:1540
virtual ~Session()
Definition: blpapi_session.h:1206
#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:1213
Provide a dispatcher to dispatch events.
friend void blpapi_eventHandlerAdapter(blpapi_Event_t *event, blpapi_Session_t *, void *userData)
Definition: blpapi_session.h:1171
~SubscriptionIterator()
Definition: blpapi_session.h:1554
virtual void resubscribe(const SubscriptionList &subscriptions)
Definition: blpapi_session.h:1316
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:1523
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:1589
struct blpapi_RequestTemplate blpapi_RequestTemplate_t
Definition: blpapi_types.h:163
virtual int tryNextEvent(Event *event)
Definition: blpapi_session.h:1234
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:522
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:1575
int blpapi_Session_tryNextEvent(blpapi_Session_t *session, blpapi_Event_t **eventPointer)
No longer active, terminated by Application.
Definition: blpapi_session.h:529
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:1220
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:1447
virtual void setStatusCorrelationId(const Service &service, const CorrelationId &correlationID)
Definition: blpapi_session.h:1453
bool next()
Definition: blpapi_session.h:1559
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:1491
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:1171
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:1599
virtual Event nextEvent(int timeout=0)
Definition: blpapi_session.h:1222
#define BLPAPI_SUBSCRIPTIONSTATUS_SUBSCRIBED
Definition: blpapi_defs.h:105
std::vector< SubscriptionPreprocessError > SubscriptionPreprocessErrors
Definition: blpapi_session.h:453
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