Qorus Integration Engine®  4.0.3_git
com.qoretechnologies.qorus.FsRemoteSend Class Reference

Java wrapper for the OMQ::FsRemoteSend class in Qorus. More...

Inheritance diagram for com.qoretechnologies.qorus.FsRemoteSend:
org::qore::jni::QoreObjectWrapper

Public Member Methods

 FsRemoteSend (QoreObject obj)
 creates the object as a wrapper for the Qore object
 
 FsRemoteSend (String remote, String path, HashMap< String, Object > options) throws Throwable
 constructor taking a DbRemote object for the remote server More...
 
 FsRemoteSend (DbRemote remote, String path) throws Throwable
 constructor taking a DbRemote object for the remote server More...
 
void commit () throws Throwable
 this method flushes all buffered I/O to the remote server and returns when all data have been sent to the server and the socket I/O thread has terminated More...
 
void cancel () throws Throwable
 this method purges any queued I/O and stops the socket thread and returns when the socket I/O thread has terminated More...
 
void append (String data) throws Throwable
 Append data to the ready queue. More...
 
void append (byte[] data) throws Throwable
 Append data to the ready queue. More...
 
void rename (String target, boolean man) throws Throwable
 executes an implicit commit() and renames/moves the file given in path in the constructor() More...
 
void del () throws Throwable
 executes an implicit commit() and deletes the file given in path in the constructor() More...
 
StreamConfig config () throws Throwable
 returns the configuration object
 

Detailed Description

Java wrapper for the OMQ::FsRemoteSend class in Qorus.

Constructor & Destructor Documentation

◆ FsRemoteSend() [1/2]

com.qoretechnologies.qorus.FsRemoteSend.FsRemoteSend ( String  remote,
String  path,
HashMap< String, Object options 
) throws Throwable
inline

constructor taking a DbRemote object for the remote server

Parameters
remotea string giving the name of the remote connection for the remote server
patha string with full or relative path of the target file (inluding file name)
optionsoptional Streaming API Constructor Options as follows:
  • "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
  • "block": data block size (default 16384, minimum 4096); the number of bytes sent in each DataStream protocol chunk
  • "queue_block_size": the number of blocks to queue for sending before the main data thread will block (default: 2)
  • "queue_timeout": the number of milliseconds to wait for queue data before throwing a QUEUE-TIMEOUT exception
  • "no_remote_timeout": if True the "timeout" option will not be sent to the remote
Note
  • to calculate the total data queued for the socket I/O thread, multiply block by queue_block_size (default 16384 * 2 = 32768 bytes)
  • the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

◆ FsRemoteSend() [2/2]

com.qoretechnologies.qorus.FsRemoteSend.FsRemoteSend ( DbRemote  remote,
String  path 
) throws Throwable
inline

constructor taking a DbRemote object for the remote server

Parameters
remotea string giving the name of the remote connection for the remote server
patha string with full or relative path of the target file (inluding file name)
Note
the explicit or default timeout value here overrides any socket I/O timeout set for the remote connection object

Member Function Documentation

◆ append() [1/2]

void com.qoretechnologies.qorus.FsRemoteSend.append ( String  data) throws Throwable
inline

Append data to the ready queue.

Example:
FsRemoteSend fs = new FsRemoteSend(qrest, target_path, opts);
try {
// send all strings in an array of strings
for (String str : array) {
fs.append(str);
}
// finalize the data transfer
fs.commit();
} catch (Throwable e) {
// cancel the send stream
fs.cancel();
} finally {
// release the weak reference to the Qore object
fs.release();
}
Parameters
datadata to be sent

Data are queued for sending when the buffered byte count reaches the block size.

Note
  • make sure to call either commit() (to flush all data to the server) or cancel() (to cancel the I/O operation) before continuing (see the example above)
  • exceptions thrown in the socket I/O thread will be rethrown when this method is called so that errors can be handled in the main data thread

◆ append() [2/2]

void com.qoretechnologies.qorus.FsRemoteSend.append ( byte []  data) throws Throwable
inline

Append data to the ready queue.

Example:
FsRemoteSend fs = new FsRemoteSend(qrest, target_path, opts);
try {
// send all strings in an array of strings
for (String str : array) {
fs.append(str);
}
// finalize the data transfer
fs.commit();
} catch (Throwable e) {
// cancel the send stream
fs.cancel();
} finally {
// release the weak reference to the Qore object
fs.release();
}
Parameters
datadata to be sent

Data are queued for sending when the buffered byte count reaches the block size.

Note
  • make sure to call either commit() (to flush all data to the server) or cancel() (to cancel the I/O operation) before continuing (see the example above)
  • exceptions thrown in the socket I/O thread will be rethrown when this method is called so that errors can be handled in the main data thread

◆ cancel()

void com.qoretechnologies.qorus.FsRemoteSend.cancel ( ) throws Throwable
inline

this method purges any queued I/O and stops the socket thread and returns when the socket I/O thread has terminated

Example:
FsRemoteSend fs = new FsRemoteSend(qrest, target_path, opts);
try {
// send all strings in an array of strings
for (String str : array) {
fs.append(str);
}
// finalize the data transfer
fs.commit();
} catch (Throwable e) {
// cancel the send stream
fs.cancel();
} finally {
// release the weak reference to the Qore object
fs.release();
}
Note
either this method or commit() should be called to ensure that all data has been sent

◆ commit()

void com.qoretechnologies.qorus.FsRemoteSend.commit ( ) throws Throwable
inline

this method flushes all buffered I/O to the remote server and returns when all data have been sent to the server and the socket I/O thread has terminated

Example:
FsRemoteSend fs = new FsRemoteSend(qrest, target_path, opts);
try {
// send all strings in an array of strings
for (String str : array) {
fs.append(str);
}
// finalize the data transfer
fs.commit();
} catch (Throwable e) {
// cancel the send stream
fs.cancel();
} finally {
// release the weak reference to the Qore object
fs.release();
}

Log messages are created with performance information (bytes send, time of transfer, bytes / second, etc).

Note
  • either this method, flush() or cancel() should be called to ensure that all data has been sent
  • exceptions thrown in the socket I/O thread will be rethrown when this method is called so that errors can be handled in the main data thread
  • equivalent to flush()
See also
flush()

◆ del()

void com.qoretechnologies.qorus.FsRemoteSend.del ( ) throws Throwable
inline

executes an implicit commit() and deletes the file given in path in the constructor()

Example:
FsRemoteSend fs = new FsRemoteSend(qrest, target_path, opts);
try {
// send all strings in an array of strings
for (String str : array) {
fs.append(str);
}
// finalize the data transfer
fs.commit();
// delete the file after the transfer
fs.del();
} catch (Throwable e) {
// cancel the send stream
fs.cancel();
} finally {
// release the weak reference to the Qore object
fs.release();
}
Note
do not call this method before all data have been sent (ie call only after calling commit() first as in the example above)

◆ rename()

void com.qoretechnologies.qorus.FsRemoteSend.rename ( String  target,
boolean  man 
) throws Throwable
inline

executes an implicit commit() and renames/moves the file given in path in the constructor()

Example:
FsRemoteSend fs = new FsRemoteSend(qrest, target_path, opts);
try {
// send all strings in an array of strings
for (String str : array) {
fs.append(str);
}
// finalize the data transfer
fs.commit();
// rename the file after the transfer
fs.rename(final_name);
} catch (Throwable e) {
// cancel the send stream
fs.cancel();
} finally {
// release the weak reference to the Qore object
fs.release();
}
Parameters
targeta new path with filename. Relative to user connection if the user connection constructor is used.
manrename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries
Warning
The original file after the rename does not exist anymore if man is set to True. Any additional append() call will result in an exception.
Note
do not call this method before all data have been sent (ie call only after calling commit() first as in the example above)

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