28 #ifndef INCLUDED_BLPAPI_PROVIDERSESSION 29 #define INCLUDED_BLPAPI_PROVIDERSESSION 147 #ifndef INCLUDED_BLPAPI_ABSTRACTSESSION 151 #ifndef INCLUDED_BLPAPI_CALL 155 #ifndef INCLUDED_BLPAPI_CORRELATIONID 159 #ifndef INCLUDED_BLPAPI_DEFS 163 #ifndef INCLUDED_BLPAPI_EVENT 167 #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER 171 #ifndef INCLUDED_BLPAPI_IDENTITY 175 #ifndef INCLUDED_BLPAPI_REQUEST 179 #ifndef INCLUDED_BLPAPI_RESOLUTIONLIST 183 #ifndef INCLUDED_BLPAPI_SERVICE 187 #ifndef INCLUDED_BLPAPI_SESSIONOPTIONS 191 #ifndef INCLUDED_BLPAPI_SUBSCRIPTIONLIST 195 #ifndef INCLUDED_BLPAPI_TOPIC 199 #ifndef INCLUDED_BLPAPI_TOPICLIST 203 #ifndef INCLUDED_BLPAPI_TYPES 213 struct blpapi_ServiceRegistrationOptions;
214 typedef struct blpapi_ServiceRegistrationOptions
246 unsigned int timeoutInMilliseconds);
254 const char *serviceName,
261 const char *serviceName,
269 const char *serviceName,
276 const char *serviceName,
278 blpapi_CorrelationId_t *correlationId,
335 const char *message);
344 int isPartialResponse);
390 unsigned int groupIdLength);
403 char *groupdIdBuffer,
430 extern "C" inline void blpapi_providerEventHandlerAdapter(
436 class ProviderSession;
536 void setGroupId(
const char *groupId,
unsigned int groupIdLength);
587 int getGroupId(
char *groupId,
int *groupIdLength)
const;
659 void dispatchEvent(
const Event& event);
722 virtual bool start();
780 const char *serviceName,
int begin,
int end,
int priority);
793 const char *serviceName,
int begin,
int end);
924 const Event& event,
bool isPartialResponse =
false);
987 virtual void deleteTopics(
const std::vector<Topic>& topics);
1001 const Topic& topic,
const char *message = 0);
1013 const std::vector<Topic>& topics,
const char *message = 0);
1021 const Topic *topics,
size_t numTopics,
const char *message = 0);
1073 : d_eventHandler_p(handler)
1075 if (dispatcher && !handler) {
1077 "Event dispatcher provided without handler.");
1081 dispatcher ? dispatcher->
impl() : 0,
1083 initAbstractSessionHandle(
1088 : d_handle_p(newHandle)
1090 initAbstractSessionHandle(
1127 d_handle_p, &event, static_cast<unsigned>(timeout)));
1128 return Event(event);
1138 *
event =
Event(impl);
1150 registrationOptions.handle())
1156 const char *serviceName,
int begin,
int end,
int priority)
1160 d_handle_p, serviceName, begin, end, priority));
1164 const char *serviceName,
int begin,
int end)
1168 d_handle_p, serviceName, begin, end));
1172 const char *serviceName,
1177 blpapi_CorrelationId_t retv = correlationId.impl();
1183 registrationOptions.handle()));
1191 d_handle_p, serviceName)
1201 assert(resolutionList);
1204 resolutionList->
impl(),
1215 resolutionList.
impl(),
1225 d_handle_p, message.impl(), &topic));
1227 return Topic(topic);
1234 d_handle_p, message.impl(), &topic));
1236 return Topic(topic);
1244 d_handle_p, service.
handle(), &topic));
1246 return Topic(topic);
1256 d_handle_p, topicList->
impl(), resolveMode, identity.
handle()));
1265 d_handle_p, topicList.
impl(), resolveMode, identity.
handle()));
1273 d_handle_p, &topicImpl, 1));
1278 if (topics.size() == 0) {
1281 std::vector<const blpapi_Topic_t *> topicImplList;
1282 topicImplList.reserve(topics.size());
1283 for (std::vector<Topic>::const_iterator it = topics.begin();
1286 topicImplList.push_back(it->impl());
1289 d_handle_p, &topicImplList[0], topicImplList.size()));
1293 const Topic *topics,
size_t numTopics)
1295 if (numTopics == 0) {
1301 std::vector<const blpapi_Topic_t *> topicImplList;
1302 topicImplList.reserve(numTopics);
1303 for (
size_t i = 0; i < numTopics; ++i) {
1304 topicImplList.push_back(topics[i].impl());
1307 d_handle_p, &topicImplList[0], topicImplList.size()));
1311 const Topic& topic,
const char *message)
1316 d_handle_p, &topicImpl, 1, message));
1320 const std::vector<Topic>& topics,
const char *message)
1322 if (topics.empty()) {
1329 const Topic *topics,
size_t numTopics,
const char *message)
1331 if (numTopics == 0) {
1337 std::vector<const blpapi_Topic_t *> topicImplList;
1338 topicImplList.reserve(numTopics);
1339 for (
size_t i = 0; i < numTopics; ++i) {
1340 topicImplList.push_back(topics[i].impl());
1346 topicImplList.size(),
1358 const Event& event,
bool isPartialResponse)
1361 d_handle_p, event.
impl(), isPartialResponse));
1370 inline void ProviderSession::dispatchEvent(
const Event& event)
1372 assert(d_eventHandler_p);
1381 d_handle_p, &allFlushed, timeoutMsecs);
1385 return allFlushed ? true :
false;
1418 int begin,
int end,
int priority)
1422 d_handle_p, begin, end, priority));
1432 const char *groupId,
unsigned int groupIdLength)
1435 d_handle_p, groupId, groupIdLength);
1441 d_handle_p, priority);
1451 char *groupIdBuffer,
int *groupIdLength)
const 1454 d_handle_p, groupIdBuffer, groupIdLength);
1469 ServiceRegistrationOptions::handle()
const 1479 extern "C" inline void blpapi_providerEventHandlerAdapter(
1484 reinterpret_cast<ProviderSession *>(userData)->dispatchEvent(Event(event));
1491 #endif // #ifdef __cplusplus 1492 #endif // #ifndef INCLUDED_BLPAPI_PROVIDERSESSION int blpapi_ServiceRegistrationOptions_addActiveSubServiceCodeRange(blpapi_ServiceRegistrationOptions_t *parameters, int start, int end, int priority)
ResolveMode
Definition: blpapi_providersession.h:667
int blpapi_ServiceRegistrationOptions_getGroupId(blpapi_ServiceRegistrationOptions_t *parameters, char *groupdIdBuffer, int *groupIdLength)
Definition: blpapi_message.h:159
virtual bool processEvent(const Event &event, ProviderSession *session)=0
#define BLPAPI_REGISTRATIONPARTS_PUBLISHING
Definition: blpapi_defs.h:128
void removeAllActiveSubServiceCodeRanges()
Definition: blpapi_providersession.h:1425
int blpapi_ServiceRegistrationOptions_setServicePriority(blpapi_ServiceRegistrationOptions_t *parameters, int priority)
int blpapi_ProviderSession_flushPublishedEvents(blpapi_ProviderSession_t *session, int *allFlushed, int timeoutMsecs)
virtual void createTopics(TopicList *topicList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1249
int setServicePriority(int priority)
Definition: blpapi_providersession.h:1438
#define BLPAPI_CALL_PROVIDERSESSION_DEACTIVATESUBSERVICECODERANGE( a1, a2, a3, a4)
Definition: blpapi_call.h:440
Low priority (0)
Definition: blpapi_providersession.h:479
#define BLPAPI_RESOLVEMODE_DONT_REGISTER_SERVICES
Definition: blpapi_defs.h:116
virtual void deleteTopics(const std::vector< Topic > &topics)
Definition: blpapi_providersession.h:1276
virtual ~ProviderSession()
Definition: blpapi_providersession.h:1094
int blpapi_ProviderSession_registerServiceAsync(blpapi_ProviderSession_t *session, const char *serviceName, const blpapi_Identity_t *identity, blpapi_CorrelationId_t *correlationId, blpapi_ServiceRegistrationOptions_t *registrationOptions)
Medium priority (INT_MAX/2)
Definition: blpapi_providersession.h:481
int blpapi_ProviderSession_deleteTopics(blpapi_ProviderSession_t *session, const blpapi_Topic_t **topics, size_t numTopics)
virtual bool flushPublishedEvents(int timeoutMsecs)
Definition: blpapi_providersession.h:1377
Common definitions used by the library.
struct blpapi_Event blpapi_Event_t
Definition: blpapi_types.h:139
RegistrationParts
Definition: blpapi_providersession.h:489
int blpapi_ProviderSession_deactivateSubServiceCodeRange(blpapi_ProviderSession_t *session, const char *serviceName, int begin, int end)
void setGroupId(const char *groupId, unsigned int groupIdLength)
Definition: blpapi_providersession.h:1431
struct blpapi_TopicList blpapi_TopicList_t
Definition: blpapi_topiclist.h:88
int blpapi_ServiceRegistrationOptions_getPartsToRegister(blpapi_ServiceRegistrationOptions_t *parameters)
Definition: blpapi_providersession.h:494
Definition: blpapi_abstractsession.h:215
virtual void deactivateSubServiceCodeRange(const char *serviceName, int begin, int end)
Definition: blpapi_providersession.h:1163
virtual Topic createTopic(const Message &message)
Definition: blpapi_providersession.h:1221
::BloombergLP::blpapi::ProviderEventHandler EventHandler
Definition: blpapi_providersession.h:648
virtual Topic getTopic(const Message &message)
Definition: blpapi_providersession.h:1230
#define BLPAPI_CALL(FUNCNAME)
Definition: blpapi_call.h:353
Definition: blpapi_service.h:304
High priority (INT_MAX)
Definition: blpapi_providersession.h:483
blpapi_SessionOptions_t * handle() const
Definition: blpapi_sessionoptions.h:1361
void blpapi_ProviderSession_destroy(blpapi_ProviderSession_t *session)
virtual void publish(const Event &event)
Definition: blpapi_providersession.h:1350
Definition: blpapi_providersession.h:498
virtual void terminateSubscriptionsOnTopic(const Topic &topic, const char *message=0)
Definition: blpapi_providersession.h:1310
struct blpapi_ResolutionList blpapi_ResolutionList_t
Definition: blpapi_resolutionlist.h:88
int blpapi_ProviderSession_publish(blpapi_ProviderSession_t *session, blpapi_Event_t *event)
virtual void resolveAsync(const ResolutionList &resolutionList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1210
int blpapi_ProviderSession_start(blpapi_ProviderSession_t *session)
virtual void activateSubServiceCodeRange(const char *serviceName, int begin, int end, int priority)
Definition: blpapi_providersession.h:1155
int blpapi_ProviderSession_stop(blpapi_ProviderSession_t *session)
Definition: blpapi_abstractsession.h:281
virtual void stopAsync()
Definition: blpapi_providersession.h:1114
blpapi_Service_t * handle() const
Definition: blpapi_service.h:706
int blpapi_ServiceRegistrationOptions_getServicePriority(blpapi_ServiceRegistrationOptions_t *parameters)
int blpapi_ProviderSession_createTopics(blpapi_ProviderSession_t *session, blpapi_TopicList_t *topicList, int resolveMode, const blpapi_Identity_t *identity)
blpapi_ServiceRegistrationOptions_t * blpapi_ServiceRegistrationOptions_create(void)
const blpapi_ResolutionList_t * impl() const
Definition: blpapi_resolutionlist.h:535
Provide access to the entitlements for a user.
int blpapi_ProviderSession_terminateSubscriptionsOnTopics(blpapi_ProviderSession_t *session, const blpapi_Topic_t **topics, size_t numTopics, const char *message)
int blpapi_ProviderSession_activateSubServiceCodeRange(blpapi_ProviderSession_t *session, const char *serviceName, int begin, int end, int priority)
void blpapi_ServiceRegistrationOptions_removeAllActiveSubServiceCodeRanges(blpapi_ServiceRegistrationOptions_t *parameters)
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_GETPARTSTOREGISTER(a1)
Definition: blpapi_call.h:426
A service which provides access to API data (provide or consume).
ServiceRegistrationOptions & operator=(const ServiceRegistrationOptions &rhs)
Definition: blpapi_providersession.h:1409
struct blpapi_Topic blpapi_Topic_t
Definition: blpapi_topic.h:68
int blpapi_ProviderSession_tryNextEvent(blpapi_ProviderSession_t *session, blpapi_Event_t **eventPointer)
friend void blpapi_providerEventHandlerAdapter(blpapi_Event_t *event, blpapi_ProviderSession_t *session, void *userData)
A component which defines events related operations.
virtual void resolve(ResolutionList *resolutionList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1197
int blpapi_ProviderSession_getTopic(blpapi_ProviderSession_t *session, const blpapi_Message_t *message, blpapi_Topic_t **topic)
Provide a key to identify individual subscriptions or requests.
#define BLPAPI_REGISTRATIONPARTS_OPERATIONS
Definition: blpapi_defs.h:129
int blpapi_ProviderSession_stopAsync(blpapi_ProviderSession_t *session)
struct blpapi_Message blpapi_Message_t
Definition: blpapi_message.h:70
virtual void stop()
Definition: blpapi_providersession.h:1109
blpapi_AbstractSession_t * blpapi_ProviderSession_getAbstractSession(blpapi_ProviderSession_t *session)
virtual void deleteTopic(const Topic &topic)
Definition: blpapi_providersession.h:1269
register to receive subscribe and unsubscribe messages
Definition: blpapi_providersession.h:491
int blpapi_ProviderSession_createTopicsAsync(blpapi_ProviderSession_t *session, const blpapi_TopicList_t *topicList, int resolveMode, const blpapi_Identity_t *identity)
static void throwOnError(int errorCode)
Definition: blpapi_exception.h:526
virtual Topic createServiceStatusTopic(const Service &service)
Definition: blpapi_providersession.h:1239
~ServiceRegistrationOptions()
Definition: blpapi_providersession.h:1404
virtual bool start()
Definition: blpapi_providersession.h:1099
Defines a request which can be sent for a service.
#define BLPAPI_CALL_PROVIDERSESSION_DELETETOPICS(a1, a2, a3)
Definition: blpapi_call.h:429
#define BLPAPI_CALL_PROVIDERSESSION_TERMINATESUBSCRIPTIONSONTOPICS( a1, a2, a3, a4)
Definition: blpapi_call.h:432
const blpapi_Topic_t * impl() const
Definition: blpapi_topic.h:221
struct blpapi_Identity blpapi_Identity_t
Definition: blpapi_types.h:188
int getServicePriority() const
Definition: blpapi_providersession.h:1457
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_ADDACTIVATESUBSERVICECODERANGE(a1, a2, a3, a4)
Definition: blpapi_call.h:444
Try to register services found in ResolutionList if necessary.
Definition: blpapi_providersession.h:668
struct blpapi_EventDispatcher blpapi_EventDispatcher_t
Definition: blpapi_types.h:142
#define BLPAPI_REGISTRATIONPARTS_SUBSCRIBER_RESOLUTION
Definition: blpapi_defs.h:130
#define BLPAPI_CALL_PROVIDERSESSION_ACTIVATESUBSERVICECODERANGE( a1, a2, a3, a4, a5)
Definition: blpapi_call.h:436
const blpapi_TopicList_t * impl() const
Definition: blpapi_topiclist.h:410
int blpapi_ProviderSession_resolve(blpapi_ProviderSession_t *session, blpapi_ResolutionList_t *resolutionList, int resolveMode, const blpapi_Identity_t *identity)
struct blpapi_ServiceRegistrationOptions blpapi_ServiceRegistrationOptions_t
Definition: blpapi_providersession.h:214
Definition: blpapi_providersession.h:503
virtual bool deregisterService(const char *serviceName)
Definition: blpapi_providersession.h:1188
#define BLPAPI_REGISTRATIONPARTS_PUBLISHER_RESOLUTION
Definition: blpapi_defs.h:131
Definition: blpapi_correlationid.h:201
#define BLPAPI_CALL_PROVIDERSESSION_DEREGISTERSERVICE(a1, a2)
Definition: blpapi_call.h:420
int blpapi_ProviderSession_deregisterService(blpapi_ProviderSession_t *session, const char *serviceName)
int getGroupId(char *groupId, int *groupIdLength) const
Definition: blpapi_providersession.h:1450
Definition: blpapi_eventdispatcher.h:116
int blpapi_ProviderSession_startAsync(blpapi_ProviderSession_t *session)
Provide representation of a Topic.
void blpapi_ServiceRegistrationOptions_setGroupId(blpapi_ServiceRegistrationOptions_t *parameters, const char *groupId, unsigned int groupIdLength)
Provide a dispatcher to dispatch events.
#define BLPAPI_SERVICEREGISTRATIONOPTIONS_PRIORITY_LOW
Definition: blpapi_defs.h:123
virtual ~ProviderEventHandler()
Definition: blpapi_providersession.h:443
virtual int tryNextEvent(Event *event)
Definition: blpapi_providersession.h:1131
Definition: blpapi_topiclist.h:177
void setPartsToRegister(int parts)
Definition: blpapi_providersession.h:1444
int blpapi_ProviderSession_resolveAsync(blpapi_ProviderSession_t *session, const blpapi_ResolutionList_t *resolutionList, int resolveMode, const blpapi_Identity_t *identity)
Definition: blpapi_identity.h:131
int blpapi_ProviderSession_createServiceStatusTopic(blpapi_ProviderSession_t *session, const blpapi_Service_t *service, blpapi_Topic_t **topic)
Definition: blpapi_providersession.h:645
Definition: blpapi_providersession.h:670
void blpapi_ServiceRegistrationOptions_copy(blpapi_ServiceRegistrationOptions_t *lhs, const blpapi_ServiceRegistrationOptions_t *rhs)
int blpapi_ProviderSession_nextEvent(blpapi_ProviderSession_t *session, blpapi_Event_t **eventPointer, unsigned int timeoutInMilliseconds)
virtual void sendResponse(const Event &event, bool isPartialResponse=false)
Definition: blpapi_providersession.h:1357
Definition: blpapi_topic.h:114
Definition: blpapi_providersession.h:509
virtual bool registerService(const char *serviceName, const Identity &providerIdentity=Identity(), const ServiceRegistrationOptions ®istrationOptions=ServiceRegistrationOptions())
Definition: blpapi_providersession.h:1143
void addActiveSubServiceCodeRange(int begin, int end, int priority)
Definition: blpapi_providersession.h:1417
#define BLPAPI_RESOLVEMODE_AUTO_REGISTER_SERVICES
Definition: blpapi_defs.h:117
Definition: blpapi_event.h:182
void blpapi_ServiceRegistrationOptions_destroy(blpapi_ServiceRegistrationOptions_t *parameters)
#define BLPAPI_REGISTRATIONPARTS_DEFAULT
Definition: blpapi_defs.h:127
virtual CorrelationId registerServiceAsync(const char *serviceName, const Identity &providerIdentity=Identity(), const CorrelationId &correlationId=CorrelationId(), const ServiceRegistrationOptions ®istrationOptions=ServiceRegistrationOptions())
Definition: blpapi_providersession.h:1171
virtual void terminateSubscriptionsOnTopics(const std::vector< Topic > &topics, const char *message=0)
Definition: blpapi_providersession.h:1319
Definition: blpapi_session.h:334
struct blpapi_AbstractSession blpapi_AbstractSession_t
Definition: blpapi_types.h:127
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_REMOVEALLACTIVESUBSERVICECODERANGES(a1)
Definition: blpapi_call.h:449
int blpapi_ProviderSession_sendResponse(blpapi_ProviderSession_t *session, blpapi_Event_t *event, int isPartialResponse)
void blpapi_ServiceRegistrationOptions_setPartsToRegister(blpapi_ServiceRegistrationOptions_t *parameters, int parts)
virtual bool startAsync()
Definition: blpapi_providersession.h:1104
struct blpapi_ProviderSession blpapi_ProviderSession_t
Definition: blpapi_types.h:160
blpapi_ServiceRegistrationOptions_t * blpapi_ServiceRegistrationOptions_duplicate(const blpapi_ServiceRegistrationOptions_t *parameters)
virtual Event nextEvent(int timeout=0)
Definition: blpapi_providersession.h:1119
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_SETPARTSTOREGISTER(a1, a2)
Definition: blpapi_call.h:423
int blpapi_ProviderSession_registerService(blpapi_ProviderSession_t *session, const char *serviceName, const blpapi_Identity_t *identity, blpapi_ServiceRegistrationOptions_t *registrationOptions)
A common interface shared between publish and consumer sessions.
#define BLPAPI_EXPORT
Definition: blpapi_defs.h:171
struct blpapi_Service blpapi_Service_t
Definition: blpapi_types.h:166
#define BLPAPI_SERVICEREGISTRATIONOPTIONS_PRIORITY_MEDIUM
Definition: blpapi_defs.h:124
struct blpapi_SessionOptions blpapi_SessionOptions_t
Definition: blpapi_types.h:172
Provide functions for dispatchtbl.
ServiceRegistrationOptions()
Definition: blpapi_providersession.h:1392
virtual void createTopicsAsync(const TopicList &topicList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1260
Provide a list of subscriptions.
blpapi_Event_t * impl() const
Definition: blpapi_event.h:439
Definition: blpapi_providersession.h:469
Definition: blpapi_providersession.h:441
Definition: blpapi_exception.h:238
int blpapi_ProviderSession_createTopic(blpapi_ProviderSession_t *session, const blpapi_Message_t *message, blpapi_Topic_t **topic)
Provide a representation of a list of topics.
blpapi_ProviderSession_t * blpapi_ProviderSession_create(blpapi_SessionOptions_t *parameters, blpapi_ProviderEventHandler_t handler, blpapi_EventDispatcher_t *dispatcher, void *userData)
blpapi_Identity_t * handle() const
Definition: blpapi_identity.h:381
void(* blpapi_ProviderEventHandler_t)(blpapi_Event_t *event, blpapi_ProviderSession_t *session, void *userData)
Definition: blpapi_providersession.h:217
Definition: blpapi_resolutionlist.h:195
ServiceRegistrationPriority
Definition: blpapi_providersession.h:478
Definition: blpapi_sessionoptions.h:421
blpapi_EventDispatcher_t * impl() const
Definition: blpapi_eventdispatcher.h:198
A common interface shared between publisher and consumer sessions.
int getPartsToRegister() const
Definition: blpapi_providersession.h:1462
#define BLPAPI_SERVICEREGISTRATIONOPTIONS_PRIORITY_HIGH
Definition: blpapi_defs.h:125
Provide a representation of a list of topics.