Apama  10.15.6.0
engine_client_cpp.hpp
Go to the documentation of this file.
1 /*
2  * engine_client_cpp.hpp
3  *
4  * $Copyright(c) 2002-2019, 2021-2022, 2024 Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors.$
5  * Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Cumulocity GmbH.
6  *
7  */
8 
13 #ifndef ENGINE_CLIENT_CPP_HPP
14 #define ENGINE_CLIENT_CPP_HPP
15 
16 #include <AP_Types.h>
17 #include <AP_Platform.h>
18 #include <iostream>
19 #include <sstream>
20 #include <exception>
21 #include <iterator>
22 #include <algorithm>
23 #include <utility>
24 #include <string>
25 #include <assert.h>
26 #include <sag_internal/engine_client_c.h>
27 #include <client_status_names.hpp>
28 #include <iomanip>
29 #include <vector>
30 
31 
32 using std::pair;
33 
34 #undef ERROR
35 
36 namespace com {
37 
39 namespace apama {
40 
45  class AP_ENGINE_CLIENT_API EngineException : public std::exception
46  {
47  public:
49  EngineException(const char *message);
52 
54  EngineException& operator= (const EngineException& ce) {
55  EngineException(ce).swap(*this);
56  return *this;
57  }
58 
60  virtual ~EngineException() throw();
61 
68  virtual const char* what() const throw() { return m_message; }
69 
77  virtual const char* const* getWarnings() const { return m_warnings; }
78 
79  protected:
81  void swap(EngineException &);
83  const char* const* m_warnings;
84 
85  private:
87  char *m_message;
88  };
89 
90 
92  typedef enum {
111  } LogLevel;
112 
113 
119  AP_ENGINE_CLIENT_API void setLogLevel(LogLevel level);
120 
131  AP_ENGINE_CLIENT_API void setLogFile(const AP_char8* filename, bool truncate, bool utf8 = false);
132 
137  AP_ENGINE_CLIENT_API int getLogFD();
138 
143  AP_ENGINE_CLIENT_API void setLogMutex(void *mutex);
144 
149  AP_ENGINE_CLIENT_API void reOpenLog();
150 
151 
153  AP_ENGINE_CLIENT_API AP_char8* convertToUTF8(const AP_char8* s);
154 
156  AP_ENGINE_CLIENT_API AP_char8* convertFromUTF8(const AP_char8* s);
157 
161  AP_ENGINE_CLIENT_API void char8free(char *string);
162 
166  namespace event {
167 
176  class AP_ENGINE_CLIENT_API Event
177  {
178  friend AP_ENGINE_CLIENT_API Event* createEvent(const char* eventString, const char* channelString);
179  friend AP_ENGINE_CLIENT_API void deleteEvent(Event* ev);
180 
181  public:
188  virtual const char* getText() const = 0;
189 
198  virtual const char* getChannel() const = 0;
199 
210  virtual double getTime() const = 0;
211 
213  inline friend std::ostream& operator << (std::ostream& stream, const Event& obj) {
214  stream << obj.getText();
215  return stream;
216  }
218  inline friend std::ostream& operator << (std::ostream& stream, const Event* obj) {
219  stream << obj->getText();
220  return stream;
221  }
222 
223  private:
225  Event(const Event&);
227  Event& operator= (const Event&);
228 
229  protected:
231  Event();
233  virtual ~Event();
234  };
235 
236 
248  class AP_ENGINE_CLIENT_API EventSupplier
249  {
250  friend AP_ENGINE_CLIENT_API void deleteEventSupplier(EventSupplier* evsup);
251 
252  public:
262  virtual void disconnect() = 0;
263 
264  protected:
266  EventSupplier();
268  virtual ~EventSupplier();
269 
270  private:
274  EventSupplier& operator= (const EventSupplier&);
275  };
276 
277 
288  class AP_ENGINE_CLIENT_API EventConsumer
289  {
290  public:
303  virtual void sendEvents(const Event* const* events) = 0;
304 
305  protected:
307  EventConsumer();
309  virtual ~EventConsumer();
310 
311  private:
315  EventConsumer& operator= (const EventConsumer&);
316  };
317 
321  class AP_ENGINE_CLIENT_API DisconnectableEventConsumer : public EventConsumer
322  {
323  public:
331  virtual void disconnect(const char* reason) = 0;
332 
333  protected:
337  virtual ~DisconnectableEventConsumer();
338 
339  private:
344  };
345 
346 
357  AP_ENGINE_CLIENT_API Event* createEvent(const char* eventString, const char* channelString);
358 
364  AP_ENGINE_CLIENT_API void deleteEvent(Event* ev);
365 
366 
375  AP_ENGINE_CLIENT_API void deleteEventSupplier(EventSupplier* evsup);
376 
377  } // namespace event
378 
380  namespace engine {
381 
390  class AP_ENGINE_CLIENT_API MonitorScript
391  {
392  friend AP_ENGINE_CLIENT_API MonitorScript* createMonitorScript(const char* monitorString);
393  friend AP_ENGINE_CLIENT_API void deleteMonitorScript(MonitorScript* mon);
394 
395  public:
403  virtual const char* getText() const = 0;
404 
406  inline friend std::ostream& operator << (std::ostream& stream, const MonitorScript& obj) {
407  stream << obj.getText();
408  return stream;
409  }
411  inline friend std::ostream& operator << (std::ostream& stream, const MonitorScript* obj) {
412  stream << obj->getText();
413  return stream;
414  }
415 
416  private:
420  MonitorScript& operator= (const MonitorScript&);
421 
422  protected:
424  MonitorScript();
426  virtual ~MonitorScript();
427  };
428 
429  class EngineStatus;
430  std::ostream& operator << (std::ostream& stream, const EngineStatus& obj);
431  std::ostream& operator << (std::ostream& stream, const EngineStatus* obj);
432 
433 
439  class AP_ENGINE_CLIENT_API EngineStatus
440  {
441  friend class EngineManagement; /* getStatus */
442 
443  public:
444 
450 #ifdef _MSC_VER
451 // needed or MSVC complains about the use of pair<string> here, even though it's all inlined
452 #pragma warning (disable : 4251)
453 #endif
454  class AP_ENGINE_CLIENT_API StatusIterator : public std::iterator<std::forward_iterator_tag, int>
455  {
456  public:
458  typedef pair<std::string, std::string> pair_t;
459 
461  explicit StatusIterator(const EngineStatus &es, bool end=false);
464  m_status(0),
465  m_opaqueState(0),
466  iterPair()
467  {}
470  {
471  if (m_status && m_opaqueState) m_status->disposeIterator(m_opaqueState);
472  }
474  StatusIterator operator++(int dummy/*@unused@*/)
475  {
476  StatusIterator current(*this);
477  ++(*this); //this->operator++() // prefix ++
478  return current;
479  }
481  StatusIterator& operator++();
483  bool operator==(const StatusIterator& ref) const
484  {
485  return (m_status == ref.m_status) &&
486  (((0 == m_opaqueState) && (0 == ref.m_opaqueState)) ||
487  (iterPair.first == ref.iterPair.first));
488  }
490  bool operator!=(const StatusIterator& ref) const { return !((*this)==ref); }
492  pair_t &operator*() { return iterPair; }
494  pair_t *operator->() { return &iterPair; }
496  bool valid() { return 0 != m_opaqueState; }
497 
500  : m_status(ref.m_status),
501  m_opaqueState(m_status->copyIterator(ref.m_opaqueState)),
502  iterPair(ref.iterPair)
503  {}
506  {
507  StatusIterator(other).swap(*this);
508  return *this;
509  }
510 
511  private:
513  void step();
515  void swap(StatusIterator &other)
516  {
517  std::swap(m_status, other.m_status);
518  std::swap(m_opaqueState, other.m_opaqueState);
519  std::swap(iterPair, other.iterPair);
520  }
521 
523  const EngineStatus *m_status;
525  void *m_opaqueState;
527  pair_t iterPair;
528  };
529 
534 
538  AP_uint64 getUptime() const {
539  return getStatusIntValue(client_status::UPTIME_SECONDS);
540  }
541 
545  AP_uint32 getNumContexts() const {
546  return (AP_uint32) getStatusIntValue(client_status::CONTEXTS_TOTAL);
547  }
548 
552  AP_uint32 getNumMonitors() const {
553  return (AP_uint32) getStatusIntValue(client_status::MONITORS_TOTAL);
554  }
555 
559  AP_uint32 getNumProcesses() const {
560  return (AP_uint32) getStatusIntValue(client_status::MONITOR_INSTANCES_TOTAL);
561  }
562 
566  AP_uint32 getNumJavaApplications() const {
567  return (AP_uint32) getStatusIntValue(client_status::JAVA_APPLICATIONS_TOTAL);
568  }
569 
573  AP_uint32 getNumListeners() const {
574  return (AP_uint32) getStatusIntValue(client_status::LISTENERS_TOTAL);
575  }
576 
580  AP_uint32 getNumEventTypes() const {
581  return (AP_uint32) getStatusIntValue(client_status::EVENT_TYPES_TOTAL);
582  }
583 
587  AP_uint32 getNumQueuedFastTrack() const {
588  return (AP_uint32) getStatusIntValue(client_status::QUEUED_ROUTE_TOTAL);
589  }
590 
595  AP_uint32 getNumQueuedInput() const {
596  return (AP_uint32) getStatusIntValue(client_status::QUEUED_INPUT_TOTAL);
597  }
598 
602  AP_uint64 getNumReceived() const {
603  return getStatusIntValue(client_status::INPUT_TOTAL);
604  }
605 
609  AP_uint64 getNumFastTracked() const {
610  return getStatusIntValue(client_status::ROUTE_TOTAL);
611  }
612 
616  AP_uint32 getNumConsumers() const {
617  return (AP_uint32) getStatusIntValue(client_status::CONSUMERS_TOTAL);
618  }
619 
623  AP_uint32 getNumOutEventsQueued() const {
624  return (AP_uint32) getStatusIntValue(client_status::QUEUED_OUTPUT_TOTAL);
625  }
626 
631  AP_uint64 getNumOutEventsCreated() const {
632  return getStatusIntValue(client_status::CREATED_OUTPUT_TOTAL);
633  }
634 
639  AP_uint64 getNumOutEventsSent() const {
640  return getStatusIntValue(client_status::OUTPUT_TOTAL);
641  }
642 
646  AP_uint32 getNumInputQueuedInput() const {
647  return (AP_uint32) getStatusIntValue(client_status::QUEUED_INPUT_PUBLIC_TOTAL);
648  }
649 
653  const AP_char8* getMostBackedUpInput() const {
655  }
656 
660  const AP_char8 *getSlowestReceiver() const {
662  }
663 
667  AP_uint32 getSlowestReceiverQueueSize() const {
668  return (AP_uint32) getStatusIntValue(client_status::SLOWEST_OUTPUT_QUEUE_SIZE_TOTAL);
669  }
670 
674  AP_uint32 getMostBackedUpQueueSize() const {
675  return (AP_uint32) getStatusIntValue(client_status::SLOWEST_INPUT_QUEUE_SIZE_TOTAL);
676  }
677 
681  AP_uint32 getNumSubListeners() const {
682  return (AP_uint32) getStatusIntValue(client_status::SUB_LISTENERS_TOTAL);
683  }
684 
688  AP_uint64 getNumProcessed() const {
689  return getStatusIntValue(client_status::PROCESSED_TOTAL);
690  }
698  return StatusIterator(*this);
699  }
700 
707  const_iterator end() const {
708  return StatusIterator(*this, true);
709  }
710 
714  const AP_char8* operator[] (const char *ref) const {
715  return getStatusValue(ref);
716  }
717 
721  const AP_char8* operator[] (std::string &ref) const {
722  return this->operator[](ref.c_str());
723  }
724 
731  AP_int64 getUserInt(const char* key) {
732  return userInt(key);
733  }
734 
741  AP_int64 getUserIntOr(const char* key, int alt) {
742  return userIntOr(key, alt);
743  }
744 
751  AP_float64 getUserFloat(const char* key) {
752  return userFloat(key);
753  }
754 
761  AP_float64 getUserFloatOr(const char* key, float alt) {
762  return userFloatOr(key, alt);
763  }
764 
771  AP_bool getUserBool(const char* key) {
772  return userBool(key);
773  }
774 
781  AP_bool getUserBoolOr(const char* key, bool alt) {
782  return userBoolOr(key, alt);
783  }
784 
791  const AP_char8* getUserString(const char* key) {
792  return userString(key);
793  }
794 
801  const AP_char8* getUserStringOr(const char* key, const char* alt) {
802  return userStringOr(key, alt);
803  }
804 
810  std::string getAllStatusValues() {
811  std::ostringstream ost;
812  ost << getStandardStatusValues();
813  for (EngineStatus::StatusIterator it = begin(); it != end(); ++it) {
814  if (it->first.find("user-") != std::string::npos)
815  ost << std::setw(32) << std::setiosflags(std::ios_base::left) << it->first.append(":") << it->second << std::endl;
816  }
817  return ost.str();
818  }
819 
825  std::string getStandardStatusValues() {
826  std::ostringstream ost;
827  ost << *this;
828  return ost.str();
829  }
830 
836  static std::string getRawHeader() {
837  std::ostringstream ost;
838  ost << "Uptime (ms),# Contexts,# Monitors,# Sub-monitors,# Java apps,# Listeners,";
839  ost << "# Sub-listeners,# Event types,Input queue,# Received events,";
840  ost << "Route queue,# Routed events,# Consumers,Output queue,";
841  ost << "# Created output events,# Sent output events,# Processed events,";
842  ost << "Slowest context name,Slowest context queue size,Slowest receiver,Slowest receiver queue";
843  return ost.str();
844  }
845 
851  std::string getRawHeaderAll() {
852  std::ostringstream ost;
853  ost << getRawHeader();
854  for (EngineStatus::StatusIterator it = begin(); it != end(); ++it) {
855  if (it->first.find("user-") != std::string::npos)
856  ost << "," << it->first;
857  }
858  return ost.str();
859  }
860 
867  std::ostringstream ost;
868  ost << getUptime()
869  << "," << getNumContexts()
870  << "," << getNumMonitors()
871  << "," << getNumProcesses()
872  << "," << getNumJavaApplications()
873  << "," << getNumListeners()
874  << "," << getNumSubListeners()
875  << "," << getNumEventTypes()
876  << "," << getNumQueuedInput()
877  << "," << getNumReceived()
878  << "," << getNumQueuedFastTrack()
879  << "," << getNumFastTracked()
880  << "," << getNumConsumers()
881  << "," << getNumOutEventsQueued()
882  << "," << getNumOutEventsCreated()
883  << "," << getNumOutEventsSent()
884  << "," << getStatusValue(client_status::PERSISTENCE_SNAPSHOTS_TOTAL)
889  << "," << getNumProcessed()
890  << "," << getMostBackedUpInput()
891  << "," << getMostBackedUpQueueSize()
892  << "," << getSlowestReceiver()
893  << "," << getSlowestReceiverQueueSize();
894  return ost.str();
895  }
896 
902  std::string getAllStatusValuesRaw() {
903  std::ostringstream ost;
904  ost << getStandardStatusValuesRaw();
905  for (EngineStatus::StatusIterator it = begin(); it != end(); ++it) {
906  if (it->first.find("user-") != std::string::npos)
907  ost << "," << it->second;
908  }
909  return ost.str();
910  }
911 
916  {
917  if (c_status) {
918  c_status->functions->deleteStatus(reinterpret_cast<AP_EngineStatus *>(c_status));
919  }
920  }
923  : c_status(other.c_status ? reinterpret_cast<AP_EngineStatus_API*>(other.c_status->functions->copyStatus(reinterpret_cast<AP_EngineStatus *>(other.c_status))) : 0)
924  {}
927  {
928  EngineStatus(other).swap(*this);
929  return *this;
930  }
934  EngineStatus(): c_status(0) {}
935  private:
937  EngineStatus(AP_EngineStatus_API *api): c_status(api) {}
939  void swap(EngineStatus &other) {
940  std::swap(c_status, other.c_status);
941  }
943  void getNext(const char *&name, const char *&value, void *&opaqueState) const {
944  if (c_status)
945  c_status->functions->getNextStatusItem(reinterpret_cast<AP_EngineStatus *>(c_status), &name, &value, &opaqueState);
946  }
948  const AP_char8* getStatusValue(const char *name) const {
949  return c_status->functions->getStatusValue(reinterpret_cast<AP_EngineStatus *>(c_status), name);
950  }
952  AP_uint64 getStatusIntValue(const char *name) const {
953  return c_status->functions->getStatusIntValue(reinterpret_cast<AP_EngineStatus *>(c_status), name);
954  }
956  void disposeIterator(void *opaqueState) const {
957  c_status->functions->disposeIterator(reinterpret_cast<AP_EngineStatus *>(c_status), opaqueState);
958  }
960  void *copyIterator(void *opaqueState) const {
961  return c_status->functions->copyIterator(reinterpret_cast<AP_EngineStatus *>(c_status), opaqueState);
962  }
963 
965  AP_int64 userIntOr(const char* key, AP_int64 alt) {
966  return c_status->functions->getUserIntOr(reinterpret_cast<AP_EngineStatus *>(c_status), key, alt);
967  }
969  AP_float64 userFloatOr(const char* key, AP_float64 alt) {
970  return c_status->functions->getUserFloatOr(reinterpret_cast<AP_EngineStatus *>(c_status), key, alt);
971  }
973  AP_bool userBoolOr(const char* key, AP_bool alt) {
974  return c_status->functions->getUserBoolOr(reinterpret_cast<AP_EngineStatus *>(c_status), key, alt);
975  }
977  const AP_char8* userStringOr(const char* key, const AP_char8* alt) {
978  return c_status->functions->getUserStringOr(reinterpret_cast<AP_EngineStatus *>(c_status), key, alt);
979  }
981  AP_int64 userInt(const char* key) {
982  return c_status->functions->getUserInt(reinterpret_cast<AP_EngineStatus *>(c_status), key);
983  }
985  AP_float64 userFloat(const char* key) {
986  return c_status->functions->getUserFloat(reinterpret_cast<AP_EngineStatus *>(c_status), key);
987  }
989  AP_bool userBool(const char* key) {
990  return c_status->functions->getUserBool(reinterpret_cast<AP_EngineStatus *>(c_status), key);
991  }
993  const AP_char8* userString(const char* key) {
994  return c_status->functions->getUserString(reinterpret_cast<AP_EngineStatus *>(c_status), key);
995  }
997  AP_EngineStatus_API *c_status;
998  };
999 
1000 
1004  inline std::ostream& operator << (std::ostream& stream, const EngineStatus& obj) {
1005  std::ostringstream ost;
1006  ost
1007  << "Uptime(ms): " << obj.getUptime() << std::endl
1008  << "Number of contexts: " << obj.getNumContexts() << std::endl
1009  << "Number of monitors: " << obj.getNumMonitors() << std::endl
1010  << "Number of sub-monitors: " << obj.getNumProcesses() << std::endl
1011  << "Number of Java applications: " << obj.getNumJavaApplications() << std::endl
1012  << "Number of listeners: " << obj.getNumListeners() << std::endl
1013  << "Number of sub-listeners: " << obj.getNumSubListeners() << std::endl
1014  << "Number of event types: " << obj.getNumEventTypes() << std::endl
1015  << "Events on input queue: " << obj.getNumQueuedInput() << std::endl
1016  << "Events received: " << obj.getNumReceived() << std::endl
1017  << "Events processed: " << obj.getNumProcessed() << std::endl
1018  << "Events on internal queue: " << obj.getNumQueuedFastTrack() << std::endl
1019  << "Events routed internally: " << obj.getNumFastTracked() << std::endl
1020  << "Number of consumers: " << obj.getNumConsumers() << std::endl
1021  << "Events on output queue: " << obj.getNumOutEventsQueued() << std::endl
1022  << "Output events created: " << obj.getNumOutEventsCreated() << std::endl
1023  << "Output events sent: " << obj.getNumOutEventsSent() << std::endl
1024  << "Events on input context queues: " << obj.getNumInputQueuedInput() << std::endl
1025  << "Number of persistent snapshots: " << obj[client_status::PERSISTENCE_SNAPSHOTS_TOTAL] << std::endl
1026  << "Last persistent snapshot time: " << obj[client_status::PERSISTENCE_LAST_SNAPSHOT_TIMESTAMP] << std::endl
1027  << "Persistent snapshot wait time Millis (EWMA): " << obj[client_status::PERSISTENCE_SNAPSHOT_WAIT_EWMA_SECONDS] << std::endl
1028  << "Persistent commit time Millis (EWMA): " << obj[client_status::PERSISTENCE_COMMIT_TIME_EWMA_SECONDS] << std::endl
1029  << "Last persistent snapshot rows changed (EWMA): " << obj[client_status::PERSISTENCE_SNAPSHOT_ROWS_CHANGED_EWMA_TOTAL] << std::endl
1030  << "Slowest context name: " << obj.getMostBackedUpInput() << std::endl
1031  << "Slowest context queue size: " << obj.getMostBackedUpQueueSize() << std::endl
1032  << "Slowest receiver name: " << obj.getSlowestReceiver() << std::endl
1033  << "Slowest receiver queue size: " << obj.getSlowestReceiverQueueSize() << std::endl;
1034  stream << ost.str();
1035  return stream;
1036  }
1037 
1041  inline std::ostream& operator << (std::ostream& stream, const EngineStatus* obj) {
1042  stream << *obj;
1043  return stream;
1044  }
1045 
1046  inline EngineStatus::StatusIterator::StatusIterator(const EngineStatus &es, bool end):
1047  m_status(&es),
1048  m_opaqueState(0),
1049  iterPair()
1050  {
1051  if (!end) step(); // get the first item in the map
1052  }
1053 
1055  inline EngineStatus::StatusIterator& EngineStatus::StatusIterator::operator++()
1056  {
1057  if (m_opaqueState) step();// don't step past the end
1058  return *this;
1059  }
1060 
1061  inline void EngineStatus::StatusIterator::step()
1062  {
1063  const char *name = nullptr;
1064  const char *value = nullptr;
1065 
1066  /* get the next item from the library map */
1067  m_status->getNext(name, value, m_opaqueState );
1068  if(!name || !value) {
1069  assert(!m_opaqueState);
1070  } else {
1071  iterPair = pair_t(name, value);
1072  }
1073  }
1074 
1085  class AP_ENGINE_CLIENT_API NameInfo
1086  {
1087  public:
1091  virtual const char* getName() const = 0;
1092 
1097  virtual const char* getPackage() const = 0;
1098 
1102  virtual const char* getFullyQualifiedName() const = 0;
1103 
1104  private:
1106  NameInfo(const NameInfo&);
1108  NameInfo& operator= (const NameInfo&);
1109 
1110  protected:
1112  NameInfo();
1114  virtual ~NameInfo();
1115  };
1116 
1121  class AP_ENGINE_CLIENT_API NamedMonitorInfo : public NameInfo
1122  {
1123  public:
1127  virtual unsigned int getNumSubMonitors() const = 0;
1128 
1129  private:
1133  NamedMonitorInfo& operator= (const NamedMonitorInfo&);
1134 
1135  protected:
1137  NamedMonitorInfo();
1139  virtual ~NamedMonitorInfo();
1140  };
1141 
1146  class AP_ENGINE_CLIENT_API NamedJavaApplicationInfo : public NameInfo {
1147 
1148  public:
1152  virtual unsigned int getNumListeners() const = 0;
1153 
1154  private:
1159 
1160  protected:
1164  virtual ~NamedJavaApplicationInfo();
1165  };
1166 
1171  class AP_ENGINE_CLIENT_API NamedContextInfo : public NameInfo {
1172 
1173  public:
1177  virtual unsigned int getNumSubMonitors() const = 0;
1178 
1182  virtual unsigned int getQueueSize() const = 0;
1183 
1187  virtual char const *const *getChannels() const = 0;
1188 
1189  private:
1193  NamedContextInfo& operator= (const NamedContextInfo&);
1194 
1195  protected:
1197  NamedContextInfo();
1199  virtual ~NamedContextInfo();
1200  };
1201 
1202 
1207  class AP_ENGINE_CLIENT_API NamedReceiverInfo : public NameInfo {
1208 
1209  public:
1213  virtual unsigned int getQueueSize() const = 0;
1214 
1218  virtual char const *const *getChannels() const = 0;
1219 
1223  virtual const AP_char8 *getAddress() const = 0;
1224 
1225  private:
1229  NamedReceiverInfo& operator= (const NamedReceiverInfo&);
1230 
1231  protected:
1235  virtual ~NamedReceiverInfo();
1236  };
1237 
1238 
1243  class AP_ENGINE_CLIENT_API NamedPluginReceiverInfo : public NameInfo {
1244 
1245  public:
1249  virtual unsigned int getQueueSize() const = 0;
1250 
1254  virtual char const *const *getChannels() const = 0;
1255 
1256  private:
1261 
1262  protected:
1266  virtual ~NamedPluginReceiverInfo();
1267  };
1268 
1273  class AP_ENGINE_CLIENT_API NamedEventTypeInfo : public NameInfo {
1274 
1275  public:
1279  virtual unsigned int getNumEventTemplates() const = 0;
1280 
1281  private:
1285  NamedEventTypeInfo& operator= (const NamedEventTypeInfo&);
1286 
1287  protected:
1291  virtual ~NamedEventTypeInfo();
1292  };
1293 
1298  class AP_ENGINE_CLIENT_API NamedTimerInfo : public NameInfo {
1299 
1300  public:
1304  virtual unsigned int getNumTimers() const = 0;
1305 
1306  private:
1310  NamedTimerInfo& operator= (const NamedTimerInfo&);
1311 
1312  protected:
1314  NamedTimerInfo();
1316  virtual ~NamedTimerInfo();
1317  };
1318 
1324  class AP_ENGINE_CLIENT_API NamedAggregateInfo : public NameInfo {
1325 
1326  private:
1330  NamedAggregateInfo& operator= (const NamedAggregateInfo&);
1331 
1332  protected:
1336  virtual ~NamedAggregateInfo();
1337  };
1338 
1351  class AP_ENGINE_CLIENT_API EngineInfo
1352  {
1353  friend AP_ENGINE_CLIENT_API void deleteInfo(EngineInfo* info);
1354 
1355  public:
1359  virtual unsigned int getNumMonitors() const = 0;
1360 
1364  virtual unsigned int getNumJavaApplications() const = 0;
1365 
1369  virtual unsigned int getNumEventTypes() const = 0;
1370 
1374  virtual unsigned int getNumTimers() const = 0;
1375 
1379  virtual unsigned int getNumAggregates() const = 0;
1380 
1388  virtual NamedMonitorInfo** getMonitors() const = 0;
1389 
1397  virtual NamedJavaApplicationInfo** getJavaApplications() const = 0;
1398 
1406  virtual NamedEventTypeInfo** getEventTypes() const = 0;
1407 
1415  virtual NamedTimerInfo** getTimers() const = 0;
1416 
1424  virtual NamedAggregateInfo** getAggregates() const = 0;
1425 
1429  virtual unsigned int getNumContexts() const = 0;
1430 
1438  virtual NamedContextInfo** getContexts() const = 0;
1439 
1443  virtual unsigned int getNumReceivers() const = 0;
1444 
1452  virtual NamedReceiverInfo **getReceivers() const = 0;
1453 
1457  virtual unsigned int getNumPluginReceivers() const = 0;
1458 
1466  virtual NamedPluginReceiverInfo **getPluginReceivers() const = 0;
1467 
1468  private:
1470  EngineInfo(const EngineInfo&);
1472  EngineInfo& operator= (const EngineInfo&);
1473 
1474  protected:
1476  EngineInfo();
1478  virtual ~EngineInfo();
1479  };
1480 
1481  class AP_ENGINE_CLIENT_API EngineConnection;
1482 
1499  class AP_ENGINE_CLIENT_API EngineManagement : public com::apama::event::EventConsumer
1500  {
1501  public:
1507  CONNECT_PARALLEL
1508  };
1515  virtual void injectMonitorScript(MonitorScript& script) = 0;
1516 
1532  virtual const char* const* injectMonitorScriptWithWarnings(MonitorScript& script) = 0;
1533 
1550  virtual const char* const* injectMonitorScriptWithWarningsFilename(MonitorScript& script, const char *filename) = 0;
1551 
1558  virtual void deleteName(const char * name) = 0;
1559 
1566  virtual void forceDeleteName(const char * name) = 0;
1567 
1574  virtual void killName(const char * name) = 0;
1575 
1579  virtual void deleteAll() = 0;
1580 
1589  virtual void injectJava(const AP_uint8* jarbytes, AP_uint32 size) = 0;
1590 
1607  virtual const char* const* injectJavaWithWarnings(const AP_uint8* jarbytes, AP_uint32 size) = 0;
1608 
1623  virtual const char* const* injectJavaWithWarningsFilename(const AP_uint8* jarbytes, AP_uint32 size, const char *filename) = 0;
1624 
1625 
1635  virtual void injectCDP(const AP_uint8* cdpbytes, AP_uint32 size, const char *filename=NULL) = 0;
1636 
1653  virtual const char* const* injectCDPWithWarnings(const AP_uint8* cdpbytes, AP_uint32 size) = 0;
1654 
1669  virtual const char* const* injectCDPWithWarningsFilename(const AP_uint8* cdpbytes, AP_uint32 size, const char *filename) = 0;
1670 
1676  {
1677  char *errmsg = nullptr;
1678  AP_EngineStatus *es_api = engineManagement_getStatusOpaque(this, &errmsg);
1679  if (errmsg) {
1680  com::apama::EngineException e(errmsg);
1681  free(errmsg);
1682  throw e;
1683  }
1684 
1685  return EngineStatus(reinterpret_cast<AP_EngineStatus_API *>(es_api));
1686  }
1687 
1711  virtual com::apama::event::EventSupplier* connectEventConsumer(com::apama::event::EventConsumer* consumer, const char* const* channels, bool disconnectSlow) = 0;
1712 
1729  virtual com::apama::event::EventSupplier* connectEventConsumer(com::apama::event::EventConsumer* consumer, const char* const* channels) = 0;
1730 
1753  virtual bool attachAsEventConsumerTo(EngineManagement* target, const char* const* channels, bool disconnectSlow = false, ConnectMode mode = CONNECT_LEGACY) = 0;
1754 
1755 
1778  virtual bool attachAsEventConsumerTo(const char* host, int port, const char* const* channels, bool disconnectSlow = false, ConnectMode mode = CONNECT_LEGACY) = 0;
1779 
1780 
1797  virtual void detachAsEventConsumerFrom(EngineManagement* target, const char* const* channels, ConnectMode mode = CONNECT_LEGACY) = 0;
1798 
1816  virtual void detachAsEventConsumerFrom(const char* host, int port, const char* const* channels, ConnectMode mode = CONNECT_LEGACY) = 0;
1817 
1828  virtual void sendEvents(const com::apama::event::Event* const* events) = 0;
1829 
1837  virtual void sendEventsNoBatching(const com::apama::event::Event* const* events) = 0;
1838 
1842  virtual void flushEvents() = 0;
1843 
1852  virtual EngineInfo* inspectEngine() = 0;
1853 
1870  virtual void ping() = 0;
1871 
1877  virtual bool isConnected() = 0;
1878 
1894  virtual void setReceiverConnections(const std::vector<com::apama::engine::EngineConnection>& connections) = 0;
1895 
1900  virtual const std::vector<com::apama::engine::EngineConnection> getReceiverConnections() = 0;
1901 
1902  protected:
1904  EngineManagement();
1906  virtual ~EngineManagement();
1907 
1908  private:
1912  EngineManagement& operator= (const EngineManagement&);
1913  };
1914 
1919  class AP_ENGINE_CLIENT_API EngineConnection {
1920  private:
1921  std::string host;
1922  int port;
1923  std::vector<std::string> channels;
1924  bool disconnectSlow;
1925  EngineManagement::ConnectMode connectMode;
1926 
1927  void init(const char * host, int port, bool disconnectSlow, EngineManagement::ConnectMode connectMode, const char * const * channels) {
1928  if (host == NULL || channels == NULL) {
1929  throw EngineException("EngineConnection cannot be created with null host or channels");
1930  }
1931  if (port < 0 || port > 65535) {
1932  throw EngineException("EngineConnection cannot be created with invalid port value");
1933  }
1934 
1935  this->host = std::string(host);
1936  this->port = port;
1937  this->disconnectSlow = disconnectSlow;
1938  this->connectMode = connectMode;
1939 
1940  for (const char* const* c = channels; *c != NULL; c++) {
1941  this->channels.push_back(std::string(*c));
1942  }
1943  }
1944 
1945  public:
1956  EngineConnection(const char * host, int port, bool disconnectSlow, EngineManagement::ConnectMode connectMode,
1957  const char * const * channels) {
1958  init(host, port, disconnectSlow, connectMode, channels);
1959  }
1960 
1968  EngineConnection(const char * host, int port, const char * const * channels) {
1969  init(host, port, false, EngineManagement::CONNECT_LEGACY, channels);
1970  }
1971 
1977  virtual const std::vector<std::string>& getChannels() const {
1978  return channels;
1979  }
1980 
1985  virtual const std::string& getHost() const {
1986  return host;
1987  }
1988 
1993  virtual int getPort() const {
1994  return port;
1995  }
1996 
2001  virtual bool getDisconnectSlow() const{
2002  return disconnectSlow;
2003  }
2004 
2010  return connectMode;
2011  }
2012 
2014  inline friend std::ostream& operator << (std::ostream& stream, const EngineConnection& obj) {
2015  std::ostringstream ost;
2016  ost << "EngineConnection to " << obj.host << ":" << obj.port << (obj.disconnectSlow == true ? " diconnectSlow" : "") << " on" <<
2017  (obj.connectMode == EngineManagement::CONNECT_PARALLEL ? " parallel" : "") << " channels [";
2018 
2019  if (!obj.channels.empty()) {
2020  std::copy(obj.channels.begin(), obj.channels.end() - 1, std::ostream_iterator<std::string>(ost, ", "));
2021  ost << obj.channels.back();
2022  }
2023  ost << "]";
2024  stream << ost.str();
2025  return stream;
2026  }
2027 
2029  inline friend std::ostream& operator << (std::ostream& stream, const EngineConnection* obj) {
2030  stream << *obj;
2031  return stream;
2032  }
2033 
2035  virtual ~EngineConnection() {
2036  }
2037  };
2038 
2045  AP_ENGINE_CLIENT_API void engineInit(const char* processName = "C++ Client");
2046 
2047 
2054  AP_ENGINE_CLIENT_API void engineInitMessaging(const char *processName, bool initMessaging=true);
2055 
2061  AP_ENGINE_CLIENT_API void engineShutdown();
2062 
2063 
2078  AP_ENGINE_CLIENT_API EngineManagement* connectToEngine(const char* host, unsigned short port, bool disconnectSlowReceiver = false, const char *processName = nullptr);
2079 
2093  AP_ENGINE_CLIENT_API EngineManagement* connectToEngineReceiveOnly(const char* host, unsigned short port, const char *processName = nullptr);
2094 
2107  AP_ENGINE_CLIENT_API EngineManagement* connectToEngineMonitorOnly(const char* host, unsigned short port, const char *processName = nullptr);
2108 
2118  AP_ENGINE_CLIENT_API void disconnectFromEngine(EngineManagement* corr);
2119 
2126  AP_ENGINE_CLIENT_API MonitorScript* createMonitorScript(const char* monitorString);
2127 
2133  AP_ENGINE_CLIENT_API void deleteMonitorScript(MonitorScript* mon);
2134 
2144  AP_ENGINE_CLIENT_API void deleteInfo(EngineInfo* info);
2145 
2146 
2154  AP_ENGINE_CLIENT_API void deleteWarnings(const char* const* warnings);
2155 
2168  AP_ENGINE_CLIENT_API void setEngineParams(const char* params);
2169 
2170  } // namespace engine
2171 
2172 } // namespace apama
2173 
2174 } // namespace com
2175 
2176 
2177 #endif // ENGINE_CLIENT_CPP_HPP
static char const *const PERSISTENCE_SNAPSHOT_WAIT_EWMA_SECONDS
The EWMA of time taken to wait for a snapshot, in milliseconds.
Definition: client_status_names.hpp:63
AP_uint64 getNumFastTracked() const
The number of events that have been routed across all contexts since the correlator was started.
Definition: engine_client_cpp.hpp:609
AP_uint32 getNumListeners() const
The number of listeners in all contexts.
Definition: engine_client_cpp.hpp:573
AP_uint64 getUptime() const
The time in milliseconds since the correlator was started.
Definition: engine_client_cpp.hpp:538
AP_ENGINE_CLIENT_API void deleteInfo(EngineInfo *info)
This function allows deletion of an EngineInfo object.
static char const *const PERSISTENCE_SNAPSHOTS_TOTAL
Number of snapshots since startup.
Definition: client_status_names.hpp:59
AP_ENGINE_CLIENT_API void setLogLevel(LogLevel level)
Sets the level at which the client library will log information.
virtual const char *const * getWarnings() const
Retrieve the set of warnings associated with the exception.
Definition: engine_client_cpp.hpp:77
AP_ENGINE_CLIENT_API void setEngineParams(const char *params)
Set custom parameters for this instance of the client library.
Derived class from EventConsumer which implements the disconnect API.
Definition: engine_client_cpp.hpp:321
AP_uint32 getNumJavaApplications() const
The number of Java applications and Java EPL plug-ins loaded in the correlator.
Definition: engine_client_cpp.hpp:566
Base class for a named object (i.e.
Definition: engine_client_cpp.hpp:1085
AP_uint32 getNumQueuedFastTrack() const
The sum of routed events on the route queues of all contexts.
Definition: engine_client_cpp.hpp:587
AP_uint32 getNumSubListeners() const
The number of sub-event-listeners that are active across all contexts.
Definition: engine_client_cpp.hpp:681
An EventConsumer can connect to the Engine through an EventSupplier and register to receive events.
Definition: engine_client_cpp.hpp:288
AP_float64 getUserFloatOr(const char *key, float alt)
Get a user value of type AP_float64 or the alt value if it cannot be found.
Definition: engine_client_cpp.hpp:761
virtual const char * getText() const =0
Retrieve the event's type and its contents as a string.
AP_ENGINE_CLIENT_API void engineInit(const char *processName="C++ Client")
This function must be called once per process first before any other Engine operations are carried ou...
static char const *const QUEUED_INPUT_PUBLIC_TOTAL
Total number of events on input contexts' queues.
Definition: client_status_names.hpp:35
virtual EngineManagement::ConnectMode getConnectMode() const
Get the connection mode associated with this connection.
Definition: engine_client_cpp.hpp:2009
const AP_char8 * getMostBackedUpInput() const
The name of the slowest context.
Definition: engine_client_cpp.hpp:653
AP_uint32 getNumConsumers() const
The number of external consumers/receivers connected to receive emitted events.
Definition: engine_client_cpp.hpp:616
virtual const char * getText() const =0
Retrieve the text of a MonitorScript fragment as a string.
AP_uint64 getNumOutEventsCreated() const
The number of events that have been sent or emitted to channels which have at least one external cons...
Definition: engine_client_cpp.hpp:631
~EngineStatus()
Destroy the underlying status data.
Definition: engine_client_cpp.hpp:915
EngineStatus getStatus()
Get the Engine's current operational status.
Definition: engine_client_cpp.hpp:1675
static char const *const ROUTE_TOTAL
Number of events fast tracked.
Definition: client_status_names.hpp:33
static char const *const SUB_LISTENERS_TOTAL
Number of active sub-listeners.
Definition: client_status_names.hpp:69
AP_int64 getUserIntOr(const char *key, int alt)
Get a user value of type AP_int64 or the alt value if it cannot be found.
Definition: engine_client_cpp.hpp:741
static char const *const INPUT_TOTAL
Number of events received (includes those that failed to be parsed)
Definition: client_status_names.hpp:57
AP_uint32 getNumMonitors() const
The number of EPL monitor definitions injected into the correlator.
Definition: engine_client_cpp.hpp:552
The Engine Management class acts as the interface to the Engine, and allows operations to be carried ...
Definition: engine_client_cpp.hpp:1499
static char const *const PERSISTENCE_SNAPSHOT_ROWS_CHANGED_EWMA_TOTAL
The EWMA of number of rows changed.
Definition: client_status_names.hpp:67
pair< std::string, std::string > pair_t
element type
Definition: engine_client_cpp.hpp:458
Fatal messages.
Definition: engine_client_cpp.hpp:100
AP_ENGINE_CLIENT_API void deleteMonitorScript(MonitorScript *mon)
This function allows deletion of MonitorScript objects.
AP_int64 getUserInt(const char *key)
Get a user value of type AP_int64.
Definition: engine_client_cpp.hpp:731
EngineConnection encapsulates the information related to a connection between two Apama messaging com...
Definition: engine_client_cpp.hpp:1919
Nothing logged.
Definition: engine_client_cpp.hpp:94
static char const *const CONSUMERS_TOTAL
Number of consumers attached to the correlator.
Definition: client_status_names.hpp:25
AP_bool getUserBool(const char *key)
Get a user value of type AP_bool.
Definition: engine_client_cpp.hpp:771
StatusIterator & operator=(const StatusIterator &other)
Copy assignment.
Definition: engine_client_cpp.hpp:505
AP_uint32 getNumQueuedInput() const
The number of executors on the input queues of all contexts.
Definition: engine_client_cpp.hpp:595
Information about a timer type returned by an engine inspection.
Definition: engine_client_cpp.hpp:1298
AP_ENGINE_CLIENT_API AP_char8 * convertFromUTF8(const AP_char8 *s)
Convert a string in UTF-8 to the local encoding, since most of the Apama API returns UTF-8.
Information about a context returned by an engine inspection.
Definition: engine_client_cpp.hpp:1171
static char const *const MONITORS_TOTAL
Number of monitors.
Definition: client_status_names.hpp:41
StatusIterator operator++(int dummy)
(postfix) increment this iterator
Definition: engine_client_cpp.hpp:474
std::string getStandardStatusValues()
Get the standard status values, formatted for terminal output.
Definition: engine_client_cpp.hpp:825
EngineConnection(const char *host, int port, bool disconnectSlow, EngineManagement::ConnectMode connectMode, const char *const *channels)
Definition: engine_client_cpp.hpp:1956
AP_uint32 getNumOutEventsQueued() const
The number of events waiting on output queues to be dispatched to any connected external consumers/re...
Definition: engine_client_cpp.hpp:623
static char const *const CREATED_OUTPUT_TOTAL
Number of events emitted from correlator.
Definition: client_status_names.hpp:29
AP_ENGINE_CLIENT_API void engineInitMessaging(const char *processName, bool initMessaging=true)
This function (or engineInit) must be called once per process first before any other Engine operation...
Startup and other important messages.
Definition: engine_client_cpp.hpp:96
EngineStatus & operator=(const EngineStatus &other)
Copy assignment.
Definition: engine_client_cpp.hpp:926
AP_ENGINE_CLIENT_API MonitorScript * createMonitorScript(const char *monitorString)
This function allows creation of MonitorScript objects.
StatusIterator const_iterator
Iterator type for const EngineStatus.
Definition: engine_client_cpp.hpp:533
virtual int getPort() const
Get the port associated with this connection.
Definition: engine_client_cpp.hpp:1993
An EventSupplier represents the resources created by the Engine to service a connection to an externa...
Definition: engine_client_cpp.hpp:248
static std::string getRawHeader()
Get a header for the raw output, useful for indentifying values.
Definition: engine_client_cpp.hpp:836
AP_uint32 getNumContexts() const
The number of contexts in the correlator, including the main context.
Definition: engine_client_cpp.hpp:545
static char const *const PROCESSED_TOTAL
Number of events taken of output queue.
Definition: client_status_names.hpp:49
For backwards compatibility, single serial connection.
Definition: engine_client_cpp.hpp:1505
Information about a monitor returned by an engine inspection.
Definition: engine_client_cpp.hpp:1121
static char const *const LISTENERS_TOTAL
Number of active listeners.
Definition: client_status_names.hpp:39
static char const *const SLOWEST_INPUT_QUEUE_SIZE_TOTAL
Number of executors waiting on that context's queue.
Definition: client_status_names.hpp:77
Information about a receiver returned by an engine inspection.
Definition: engine_client_cpp.hpp:1207
std::string getRawHeaderAll()
Get a header for the raw output, useful for indentifying values.
Definition: engine_client_cpp.hpp:851
AP_ENGINE_CLIENT_API void setLogFile(const AP_char8 *filename, bool truncate, bool utf8=false)
Sets the file to which the client library should log information.
ConnectMode
The mode that attachAsEventConsumerTo and detachAsEventConsumerFrom operate in.
Definition: engine_client_cpp.hpp:1503
EngineStatus()
Create a default-constructed (empty) EngineStatus.
Definition: engine_client_cpp.hpp:934
Information messages (default)
Definition: engine_client_cpp.hpp:106
Information about an aggregate function returned by an engine inspection.
Definition: engine_client_cpp.hpp:1324
Information about the monitors and types currently in an engine.
Definition: engine_client_cpp.hpp:1351
Contains the key names for all standard status values within the correlator.
virtual const std::vector< std::string > & getChannels() const
Get the channels associated with this connection.
Definition: engine_client_cpp.hpp:1977
static char const *const EVENT_TYPES_TOTAL
Number of event types defined.
Definition: client_status_names.hpp:31
std::ostream & operator<<(std::ostream &stream, const EngineStatus &obj)
Stream output operator for a reference.
Definition: engine_client_cpp.hpp:1004
AP_ENGINE_CLIENT_API void engineShutdown()
This function must be called once per process before the application closes down.
virtual const std::string & getHost() const
Get the host associated with this connection.
Definition: engine_client_cpp.hpp:1985
Information about a java application returned by an engine inspection.
Definition: engine_client_cpp.hpp:1146
AP_ENGINE_CLIENT_API void disconnectFromEngine(EngineManagement *corr)
This function allows disconnection from an Engine.
const AP_char8 * getUserString(const char *key)
Get a user value of type AP_char8*.
Definition: engine_client_cpp.hpp:791
An Event object represents an event instance.
Definition: engine_client_cpp.hpp:176
AP_uint32 getNumProcesses() const
The number of monitor instances, also known as sub-monitors.
Definition: engine_client_cpp.hpp:559
const_iterator end() const
Returns an instance of the StatusIterator which allows to iterate over all status items.
Definition: engine_client_cpp.hpp:707
Critical messages.
Definition: engine_client_cpp.hpp:98
pair_t * operator->()
Return a pointer to the element pointed to.
Definition: engine_client_cpp.hpp:494
virtual ~EngineConnection()
Destroy the underlying connection data.
Definition: engine_client_cpp.hpp:2035
AP_ENGINE_CLIENT_API EngineManagement * connectToEngineMonitorOnly(const char *host, unsigned short port, const char *processName=nullptr)
Attempt to establish a monitor-only connection to an Engine listening on the named host and port.
static char const *const QUEUED_INPUT_TOTAL
Number of events on the input queue.
Definition: client_status_names.hpp:55
static char const *const SLOWEST_INPUT_QUEUE_CONTEXT_NAME
Name of the most backlogged input context.
Definition: client_status_names.hpp:79
std::string getAllStatusValuesRaw()
Get all the status values available, formatted for parsers (values separated by ,).
Definition: engine_client_cpp.hpp:902
const_iterator begin() const
Returns an instance of the StatusIterator which allows to iterate over all status items.
Definition: engine_client_cpp.hpp:697
AP_ENGINE_CLIENT_API void reOpenLog()
Re-opens the log file.
LogLevel
Available logging levels.
Definition: engine_client_cpp.hpp:92
Information about a receiver returned by an engine inspection.
Definition: engine_client_cpp.hpp:1243
std::string getAllStatusValues()
Get all the status values available, formatted for terminal output.
Definition: engine_client_cpp.hpp:810
const AP_char8 * getSlowestReceiver() const
The name of the consumer/receiver with the largest number of incoming events waiting to be processed.
Definition: engine_client_cpp.hpp:660
AP_ENGINE_CLIENT_API EngineManagement * connectToEngineReceiveOnly(const char *host, unsigned short port, const char *processName=nullptr)
Attempt to establish a receive-only connection to an Engine listening on the named host and port.
EngineStatus(const EngineStatus &other)
Copy constructor.
Definition: engine_client_cpp.hpp:922
AP_ENGINE_CLIENT_API void deleteWarnings(const char *const *warnings)
This function allows deletion of the lists of warnings returned by injectMonitorScriptWithWarnings(),...
static char const *const OUTPUT_TOTAL
Number of events sent.
Definition: client_status_names.hpp:45
EngineConnection(const char *host, int port, const char *const *channels)
Definition: engine_client_cpp.hpp:1968
EngineStatus represents the operational status of the Engine.
Definition: engine_client_cpp.hpp:439
AP_uint32 getMostBackedUpQueueSize() const
The number of events on the slowest context's queue, as identified by the name of the slowest context...
Definition: engine_client_cpp.hpp:674
bool operator==(const StatusIterator &ref) const
Returns true if two iterators point to the same item.
Definition: engine_client_cpp.hpp:483
AP_ENGINE_CLIENT_API int getLogFD()
Get the file descriptor of this logger.
Warning messages.
Definition: engine_client_cpp.hpp:104
AP_uint32 getNumInputQueuedInput() const
The number of events on the input queues of all public contexts.
Definition: engine_client_cpp.hpp:646
AP_ENGINE_CLIENT_API AP_char8 * convertToUTF8(const AP_char8 *s)
Convert a string in local encoding to UTF-8, as required by most of the Apama API.
static char const *const QUEUED_ROUTE_TOTAL
Number of events on the fast track queue.
Definition: client_status_names.hpp:53
bool valid()
Returns true if this is a valid iterator over status data.
Definition: engine_client_cpp.hpp:496
const AP_char8 * getUserStringOr(const char *key, const char *alt)
Get a user value of type AP_char8* or the alt value if it cannot be found.
Definition: engine_client_cpp.hpp:801
AP_ENGINE_CLIENT_API Event * createEvent(const char *eventString, const char *channelString)
This function allows creation of an Event object.
static char const *const SLOWEST_OUTPUT_QUEUE_NAME
Name of the slowest receiver.
Definition: client_status_names.hpp:71
static char const *const QUEUED_OUTPUT_TOTAL
Number of events on the output queue.
Definition: client_status_names.hpp:43
std::ostream & operator<<(std::ostream &stream, const EngineStatus *obj)
Stream output operator for a pointer.
Definition: engine_client_cpp.hpp:1041
Debugging messages.
Definition: engine_client_cpp.hpp:108
AP_float64 getUserFloat(const char *key)
Get a user value of type AP_float64.
Definition: engine_client_cpp.hpp:751
Information about a event type returned by an engine inspection.
Definition: engine_client_cpp.hpp:1273
AP_ENGINE_CLIENT_API EngineManagement * connectToEngine(const char *host, unsigned short port, bool disconnectSlowReceiver=false, const char *processName=nullptr)
This function attempts to establish a connection to an Engine.
std::string getStandardStatusValuesRaw()
Get the standard status values, formatted for parsers (values separated by ,).
Definition: engine_client_cpp.hpp:866
AP_uint64 getNumProcessed() const
The number of events processed by the correlator in all contexts.
Definition: engine_client_cpp.hpp:688
StatusIterator()
Default-constructed status iterator.
Definition: engine_client_cpp.hpp:463
AP_uint64 getNumReceived() const
The number of events that the correlator has received from external sources since the correlator star...
Definition: engine_client_cpp.hpp:602
An EngineException (or instance of a derived class) is thrown by methods in this library if any probl...
Definition: engine_client_cpp.hpp:45
static char const *const PERSISTENCE_LAST_SNAPSHOT_TIMESTAMP
The clock time of the last complete snapshot.
Definition: client_status_names.hpp:61
More-verbose debug messages.
Definition: engine_client_cpp.hpp:110
A MonitorScript object encapsulates an EPL code fragment, containing package, event and monitor defin...
Definition: engine_client_cpp.hpp:390
static char const *const UPTIME_SECONDS
Uptime in ms.
Definition: client_status_names.hpp:23
AP_ENGINE_CLIENT_API void char8free(char *string)
Free any char* string returned from the client API.
A class used for the iterating through all status items.
Definition: engine_client_cpp.hpp:454
AP_ENGINE_CLIENT_API void deleteEvent(Event *ev)
This function allows deletion of an Event object.
StatusIterator iterator
Iterator type.
Definition: engine_client_cpp.hpp:531
static char const *const CONTEXTS_TOTAL
Number of contexts in the correlator.
Definition: client_status_names.hpp:27
AP_ENGINE_CLIENT_API void deleteEventSupplier(EventSupplier *evsup)
This function disconnects and deletes an EventSupplier object.
static char const *const SLOWEST_OUTPUT_QUEUE_SIZE_TOTAL
Number of events waiting on that receiver's queue.
Definition: client_status_names.hpp:73
AP_uint32 getNumEventTypes() const
The number of event types defined within the correlator.
Definition: engine_client_cpp.hpp:580
bool operator!=(const StatusIterator &ref) const
Returns false if two iterators point to the same item.
Definition: engine_client_cpp.hpp:490
~StatusIterator()
Destroy underling status iterator.
Definition: engine_client_cpp.hpp:469
static char const *const MONITOR_INSTANCES_TOTAL
Number of monitor processes.
Definition: client_status_names.hpp:51
virtual bool getDisconnectSlow() const
Get the value of disconnectSlow flag associated with this connection.
Definition: engine_client_cpp.hpp:2001
Error messages.
Definition: engine_client_cpp.hpp:102
static char const *const PERSISTENCE_COMMIT_TIME_EWMA_SECONDS
The EWMA of time taken to commit, in milliseconds.
Definition: client_status_names.hpp:65
StatusIterator(const StatusIterator &ref)
Copy constructor.
Definition: engine_client_cpp.hpp:499
AP_uint64 getNumOutEventsSent() const
The number of events that have been delivered to external consumers/receivers.
Definition: engine_client_cpp.hpp:639
AP_uint32 getSlowestReceiverQueueSize() const
The number of events on the slowest consumer's/receiver's queue, as identified by the name of the slo...
Definition: engine_client_cpp.hpp:667
AP_bool getUserBoolOr(const char *key, bool alt)
Get a user value of type AP_bool or the alt value if it cannot be found.
Definition: engine_client_cpp.hpp:781
static char const *const JAVA_APPLICATIONS_TOTAL
Number of java applications.
Definition: client_status_names.hpp:37