Qorus Integration Engine®  4.1.4.p4_git
OMQ::DbRemoteRawReceive Class Reference

A class for inbound/reading data from the remote instance from a raw SQL query, I/O is handled in a background thread and is made available in the getData() and getAllData() methods. More...

Inheritance diagram for OMQ::DbRemoteRawReceive:
OMQ::DbRemoteReceive OMQ::AbstractParallelReceiveStream DataStreamClient::DataStreamRecvMessage OMQ::AbstractParallelStream

Public Member Methods

 constructor (DbRemoteBase remote, string sql, *softlist< auto > args, *hash< auto > options)
 constructor taking an OMQ::DbRemoteBase object for the remote connection More...
 
 constructor (string remote, string datasource, string sql, *softlist< auto > args, *hash< auto > options)
 constructor taking a string giving the name of the remote connection for the remote server More...
 
 constructor (QorusSystemRestHelper remote, string datasource, string sql, *softlist< auto > args, *hash< auto > options)
 constructor taking an OMQ::QorusSystemRestHelper object for the remote connection and assuming the "select" stream More...
 
- Public Member Methods inherited from OMQ::DbRemoteReceive
private constructor (*hash< auto > options, DbRemoteBase remote, string sql, *list< auto > args)
 Private constructor.
 
private constructor (*hash< auto > options, string remote, string datasource, string sql, *list< auto > args)
 Private constructor.
 
private constructor (*hash< auto > options, QorusSystemRestHelper remote, string datasource, string sql, *list< auto > args)
 Private constructor.
 
 constructor (DbRemoteBase remote, string stream, string table_name, *hash< auto > options)
 constructor taking an OMQ::DbRemoteBase object for the remote connection More...
 
 constructor (DbRemoteBase remote, string table_name, *hash< auto > options)
 constructor taking an OMQ::DbRemoteBase object for the remote connection and assuming the "select" stream More...
 
 constructor (string remote, string datasource, string stream, string table_name, *hash< auto > options)
 constructor taking a string giving the name of the remote connection for the remote server More...
 
 constructor (string remote, string datasource, string table_name, *hash< auto > options)
 constructor taking a string giving the name of the remote connection for the remote server and assuming the "select" stream More...
 
 constructor (QorusSystemRestHelper remote, string datasource, string stream, string table_name, *hash< auto > options)
 constructor taking an OMQ::QorusSystemRestHelper object for the remote connection More...
 
 constructor (QorusSystemRestHelper remote, string datasource, string table_name, *hash< auto > options)
 constructor taking an OMQ::QorusSystemRestHelper object for the remote connection and assuming the "select" stream More...
 
 openStream (string stream, string table_name, *hash< auto > options)
 flushes the current stream and reopens a new stream with the same remote connection and in the same datasource More...
 
private throwAbortedExceptionImpl (string meth)
 throw a user-friendly exception about why the I/O thread was aborted and the connection forcibly closed and how to avoid such situations in the future
 
private startStreamImpl ()
 opens the remote transaction if necessary
 
private socketThreadImpl ()
 receive reimplementation
 
 commit ()
 Commit remote transaction. More...
 
 rollback (bool action=DO_DISCONNECT)
 Rollback remote transaction. More...
 
 disconnect ()
 Disconnects the connection.
 
private nothing recvDataImpl (auto rdata)
 An abstract method to handle incoming data. More...
 
private nothing recvDataDoneImpl (*string err)
 called when all data has been received or the background I/O operation terminates due to an error
 
*hash< auto > getData (*timeout timeout_ms)
 returns queued data as soon as it is available, if the timeout is omitted or equal or less than 0, no timeout is used and the call will block until data is available on the queue; once this method return NOTHING it signifies that the end of stream data condition has been reached; do not call this method again after it returns NOTHING More...
 
*hash< auto > getAllData (*timeout timeout_ms)
 returns all data recevied by the object in a single call, if the timeout is omitted or equal or less than 0, no timeout is used and the call will block until data is available on the queue More...
 
*list< auto > getDataRows (*timeout timeout_ms)
 returns queued data as a list<auto> of rows as soon as it is available, if the timeout is omitted or equal or less than 0, no timeout is used and the call will block until data is available on the queue; once this method return NOTHING it signifies that the end of stream data condition has been reached; do not call this method again after it returns NOTHING More...
 
*list< auto > getAllDataRows (*timeout timeout_ms)
 returns all data recevied by the object in a single call as a list<auto> of rows, if the timeout is omitted or equal or less than 0, no timeout is used and the call will block until data is available on the queue More...
 
private checkComplete (string meth)
 checks if data is requested after the transfer is complete
 
OMQ::StreamConfig config ()
 returns the configuration object
 
- Public Member Methods inherited from OMQ::AbstractParallelReceiveStream
 destructor ()
 disconnects and aborts the I/O thread if it's still running
 
nothing cleanup ()
 called when the thread resource is still allocated and the thread exits or one of Qore::throw_thread_resource_exceptions() or Qore::throw_thread_resource_exceptions_to_mark() is called
 
private abortInternMethod (string meth)
 if the I/O thread is running, then abort it, disconnect the connection, and throw a user-friendly exception what happened and how to avoid such situations in the future
 
private abortIntern (string meth, string fmt)
 if the I/O thread is running, then abort it, disconnect the connection, and throw a user-friendly exception what happened and how to avoid such situations in the future
 

Additional Inherited Members

- Private Attributes inherited from OMQ::DbRemoteReceive
DbSelectStreamConfig m_config
 stream configuration
 
bool complete
 flag indicating that all data has been taken from the Queue
 

Detailed Description

A class for inbound/reading data from the remote instance from a raw SQL query, I/O is handled in a background thread and is made available in the getData() and getAllData() methods.

See also
OMQ::DbRemoteReceive for information about usage
Example:
DbRemoteRawReceive recv(qrest, "omquser", sql, args, ("block": 2000));
while (*hash<auto> h = recv.getData()) {
processData(h);
}
Note
a remote transaction is only started in this object's constructor if the transaction option is set, otherwise the remote transaction status is left unchanged

Member Function Documentation

◆ constructor() [1/3]

OMQ::DbRemoteRawReceive::constructor ( DbRemoteBase  remote,
string  sql,
*softlist< auto >  args,
*hash< auto >  options 
)

constructor taking an OMQ::DbRemoteBase object for the remote connection

Example:
DbRemoteRawReceive recv(db, sql);
while (*hash<auto> h = recv.getData()) {
processData(h);
}
Parameters
remotean OMQ::DbRemoteBase object
sqlthe SQL for the select statement in the remote DB
argsoptional bind arguments for the SQL statement
optionsoptional Streaming API Constructor Options as follows:
  • "block": data block size; the number of rows to retrieve from the remote database and send in each block
  • "block_queue_size": the number of blocks to queue for receiving before the I/O thread will block (default: 2); the total number of rows that can be queued = block_queue_size * block
  • "timeout": an HTTP socket timeout value in milliseconds; used locally and in the remote for socket I/O and queue operations; default value: 5m
  • "loglevel": a default log level option for logging; see Log Levels for valid value
  • "no_remote_timeout": if True the "timeout" option will not be sent to the remote
  • "transaction": start a remote transaction; if this option is not given, the remote transaction status is left unchanged
Note
  • this class always uses the system.sqlutil service stream: "select_raw"
  • a remote transaction is only started in this object's constructor if the transaction option is set, otherwise the remote transaction status is left unchanged
  • the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

◆ constructor() [2/3]

OMQ::DbRemoteRawReceive::constructor ( string  remote,
string  datasource,
string  sql,
*softlist< auto >  args,
*hash< auto >  options 
)

constructor taking a string giving the name of the remote connection for the remote server

Example:
DbRemoteRawReceive recv(remote_name, datasource_name, sql);
while (*hash<auto> h = recv.getData()) {
processData(h);
}
Parameters
remotea string giving the name of the remote connection for the remote server
datasourcea string with name of the remote datasource to use
sqlthe SQL for the select statement in the remote DB
argsoptional bind arguments for the SQL statement
optionsoptional Streaming API Constructor Options as follows:
  • "block": data block size; the number of rows to retrieve from the remote database and send in each block
  • "block_queue_size": the number of blocks to queue for receiving before the I/O thread will block (default: 2); the total number of rows that can be queued = block_queue_size * block
  • "timeout": an HTTP socket timeout value in milliseconds; used locally and in the remote for socket I/O and queue operations; default value: 5m
  • "loglevel": a default log level option for logging; see Log Levels for valid value
  • "no_remote_timeout": if True the "timeout" option will not be sent to the remote
  • "transaction": start a remote transaction; if this option is not given, the remote transaction status is left unchanged
Note
  • this class always uses the system.sqlutil service stream: "select_raw"
  • a remote transaction is only started in this object's constructor if the transaction option is set, otherwise the remote transaction status is left unchanged
  • the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

◆ constructor() [3/3]

OMQ::DbRemoteRawReceive::constructor ( QorusSystemRestHelper  remote,
string  datasource,
string  sql,
*softlist< auto >  args,
*hash< auto >  options 
)

constructor taking an OMQ::QorusSystemRestHelper object for the remote connection and assuming the "select" stream

Example:
DbRemoteReceive recv(qrest, datasource_name, table_name);
while (*hash<auto> h = recv.getData()) {
processData(h);
}
Parameters
remotean OMQ::QorusSystemRestHelper object
datasourcea string with name of the remote datasource to use
sqlthe SQL for the select statement in the remote DB
argsoptional bind arguments for the SQL statement
optionsoptional Streaming API Constructor Options as follows:
  • "block": data block size; the number of rows to retrieve from the remote database and send in each block
  • "block_queue_size": the number of blocks to queue for receiving before the I/O thread will block (default: 2); the total number of rows that can be queued = block_queue_size * block
  • "timeout": an HTTP socket timeout value in milliseconds; used locally and in the remote for socket I/O and queue operations; default value: 5m
  • "loglevel": a default log level option for logging; see Log Levels for valid value
  • "no_remote_timeout": if True the "timeout" option will not be sent to the remote
  • "transaction": start a remote transaction; if this option is not given, the remote transaction status is left unchanged
Note
  • this class always uses the system.sqlutil service stream: "select_raw"
  • a remote transaction is only started in this object's constructor if the transaction option is set, otherwise the remote transaction status is left unchanged
  • the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

The documentation for this class was generated from the following file: