3 #ifndef STREAMBASE_CLIENT_H
4 #define STREAMBASE_CLIENT_H
6 #include "StreamBase.hpp"
7 #include "StreamBaseVersion.hpp"
8 #include "Exceptions.hpp"
11 #include "StreamProperties.hpp"
12 #include "StreamBaseEntityType.hpp"
13 #include "StreamBaseURI.hpp"
14 #include "TupleList.hpp"
15 #include "DequeueResult.hpp"
16 #include "ClientSettings.hpp"
18 SB_INTERNAL_FWD(StreamBaseClientImpl)
30 static const unsigned int DEFAULT_FLUSH_INTERVAL = 250;
35 static bool useRawTuples;
43 StreamBaseClient(
const StreamBaseURI& uri = StreamBaseURI::fromEnvironment(),
45 int flush_interval=DEFAULT_FLUSH_INTERVAL);
47 StreamBaseClient(
const std::string& uris,
49 int flush_interval=DEFAULT_FLUSH_INTERVAL);
51 StreamBaseClient(
const std::vector<StreamBaseURI>& uris,
53 int flush_interval=DEFAULT_FLUSH_INTERVAL);
55 StreamBaseClient(
const std::vector<StreamBaseURI>& uris,
58 int flush_interval=DEFAULT_FLUSH_INTERVAL);
70 FULLY_QUALIFIED_NAMES = 1,
76 ALL_CONTAINERS = 4 | FULLY_QUALIFIED_NAMES
83 void listEntities(
const std::string &type,
int flags, std::vector<std::string>& names);
98 std::string describe(
const std::string &entity);
102 bool checkLicense(
const std::string &featureName);
107 bool isStreamSubscribed(
const std::string &entity);
122 Schema getSchemaForStream(
const std::string &entity,
131 void typecheck(
const std::string &sbapp,
132 std::map<std::string, Schema>& streams,
161 StreamProperties subscribe(
const std::string &stream_name,
const std::string &logical_stream,
const std::string &predicate);
180 StreamProperties resubscribe(
const std::string &stream_name,
const std::string &logical_stream,
const std::string &predicate);
188 void unsubscribe(
const std::string &stream_name);
241 TupleList dequeue(std::string &stream_name);
280 void enqueue(
const std::string &stream_name,
Tuple& tuple) ;
306 void enqueue(
const std::string &stream_name,
TupleList& tuples) ;
322 Schema getSchemaByHash(
const std::string &hash);
327 Schema getSchemaByName(
const std::string &name);
330 void operatorStatus(
const std::string &containerName, std::vector<std::string> &aStatus);
333 void status(std::vector<std::string> &aStatus,
bool verbose =
false);
338 const std::vector<StreamBaseURI>& getURIs()
const;
360 void enableHeartbeating();
371 void enableBuffering(
int buffer_size,
int flush_interval = DEFAULT_FLUSH_INTERVAL);
381 void enableConnectionlessEnqueue(
bool enable);
388 bool getIsConnectionlessEnqueue();
395 void flushAllBuffers();
418 void flushBuffer(
const std::string &stream_name);
421 bool getIsBuffering()
const;
424 int getBufferSize()
const;
429 std::string getConnectionID()
const;
437 Tuple getDynamicVariables(
const std::string& modulePath);
443 void setDynamicVariable(
const std::string& dynamicVariablePath,
const std::string& value);
448 std::string getConnectionIdAsHexString()
const;
455 TupleList readTable(
const std::string &tablePath,
int limit,
const std::string& predicate=
"");
460 void internalCommand(
const std::vector<std::string>& arguments, std::vector<std::string> &result);
472 int setQuiescentLimit(
int timeoutMS);
476 return std::string(StreamBaseVersion::INFO_LINE);
483 return _clientSettings;
489 long long getTupleEnqueueCount()
const;
495 long long getTupleDequeueCount()
const;
498 typedef std::map<std::string, StreamProperties> StreamMap;
500 std::shared_ptr<sb_internal::StreamBaseClientImpl> _impl;
503 StreamBaseClient(
const StreamBaseClient&);
506 StreamBaseClient& operator = (
const StreamBaseClient&);
511 StreamMap _streamMap;