Constructor
new Writer()
Internal use only. Use Participant.createWriter() or Publisher.createWriter().
Extends:
- See:
-
- QoS.writerDefault() to create a QoS object for a writer
- QoSProvider.getWriterQos() on retreiving an externally writer QoS policy from a QoSProvider.
Extends
Members
livelinessLostStatus :module:vortexdds~LivelinessLostStatus
Get the LivelinessLostStatus object of the writer.
Type:
offeredDeadlineMissedStatus :module:vortexdds~OfferedDeadlineMissedStatus
Get the OfferedDeadlineMissedStatus object of the writer.
Type:
offeredIncompatibleQosStatus :module:vortexdds~OfferedIncompatibleQosStatus
Get the OfferedIncompatibleQosStatus object of the writer.
Type:
publicationMatchedStatus :module:vortexdds~PublicationMatchedStatus
Get the PublicationMatchedStatus object of the writer.
Type:
qos :module:vortexdds.QoS
The existing QoS policies for the entity.
Type:
- Overrides:
topic :module:vortexdds.Topic
The topic instance with which the writer is associated.
Type:
Methods
createStatusCondition(maskopt) → {module:vortexdds.StatusCondition}
Creates a StatusCondition for use in wait set.
Omitting the mask value results in all entity-appropriate status conditions being enabled.
Note that DDS resources and memory consumed by conditions cannot be automatically reclaimed by the NodeJS engine. Conditions are automatically deleted when the parent entity is deleted. Otherwise, when your application is finished with a Condition, you may call Condition.delete() to release these DDS resources.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mask |
module:vortexdds.StatusMask |
<optional> |
null | mask of StatusMask values of interest |
Throws:
-
if the status mask is invalid
Returns:
delete() → {external:Promise}
Releases the DDS resources associated with the entity and all its 'child' entities.
In some cases, releasing DDS resources can take several seconds. This methods returns a Promise that enables you to do processing after all the resources have been released.
- Overrides:
Returns:
- Type
- external:Promise
dispose(data, timestampopt) → {number}
Dispose a DDS instance.
Note: Cannot be used if the writer's reliability QoS policy is set to kind Reliable. If this method is called on such a writer, a module:vortexdds.DDSError is thrown with the ddsErrCode field set to DDSErrorCode ILLEGAL_OPERATION.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
data |
object | data specifying the instance; only key field values are required. |
||
timestamp |
number | string |
<optional> |
null | a source timestamp, specified in nanoseconds since midnight, January 1, 1970. Represents a 64-bit value. May be a string if the JavaScript numeric representation would result in a loss of precision. |
Throws:
-
if the sample cannot be disposed
Returns:
Zero (0).
- Type
- number
disposeReliable(data, timestampopt) → {external:Promise.<number>}
Asynchronously dispose of a DDS instance.
This method returns a Promise that resolves with a value of zero (0) once the write has completed. If an error occurs, the promise rejects with a DDSError.
When a writer's reliability QoS policy is set to kind Reliable this operation my block while the DDS system attempts to ensure delivery of the sample. This method may be called on all writer's, regardless of the specified reliability policy.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
data |
object | data specifying the instance; only key field values are required. |
||
timestamp |
number | string |
<optional> |
null | a source timestamp, specified in nanoseconds since midnight, January 1, 1970. Represents a 64-bit value. May be a string if the JavaScript numeric representation would result in a loss of precision. |
Returns:
- Type
- external:Promise.<number>
Example
const dds = require('vortexdds');
const wr = somePreviouslyCreatedWriter;
const data = {
id: 1, // only key fields required
};
wr.disposeReliable(data)
.then(_ => {
// do any actions required after
// a successful dispose
})
.catch(err => {
// dispose was unsuccessful
});
statusChanges() → {module:vortexdds.StatusMask}
Return the DDS communication statuses that have changed since this method was last called.
- Overrides:
Returns:
a mask of statuses that have changed
unregister(data, timestampopt) → {number}
Unregister an instance.
Note: Cannot be used if the writer's reliability QoS policy is set to kind Reliable. If this method is called on such a writer, a module:vortexdds.DDSError is thrown with the ddsErrCode field set to DDSErrorCode ILLEGAL_OPERATION.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
data |
object | data specifying the instance; only key field values are required. |
||
timestamp |
number | string |
<optional> |
null | a source timestamp, specified in nanoseconds since midnight, January 1, 1970. Represents a 64-bit value. May be a string if the JavaScript numeric representation would result in a loss of precision. |
Throws:
-
if the sample cannot be unregistered
Returns:
Zero (0).
- Type
- number
unregisterReliable(data, timestampopt) → {external:Promise.<number>}
Asynchronously unregister of a DDS instance.
This method returns a Promise that resolves with a value of zero (0) once the write has completed. If an error occurs, the promise rejects with a DDSError.
When a writer's reliability QoS policy is set to kind Reliable this operation my block while the DDS system attempts to ensure delivery of the sample. This method may be called on all writer's, regardless of the specified reliability policy.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
data |
object | data specifying the instance; only key field values are required. |
||
timestamp |
number | string |
<optional> |
null | a source timestamp, specified in nanoseconds since midnight, January 1, 1970. Represents a 64-bit value. May be a string if the JavaScript numeric representation would result in a loss of precision. |
Returns:
- Type
- external:Promise.<number>
Example
const dds = require('vortexdds');
const wr = somePreviouslyCreatedWriter;
const data = {
id: 1, // only key fields required
};
wr.unregisterReliable(data)
.then(_ => {
// do any actions required after
// a successful unregister
})
.catch(err => {
// unregister was unsuccessful
});
write(data, timestampopt) → {number}
Write a DDS sample.
Note: Cannot be used if the writer's reliability QoS policy is set to kind Reliable. If this method is called on such a writer, a module:vortexdds.DDSError is thrown with the ddsErrCode field set to DDSErrorCode ILLEGAL_OPERATION.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
data |
object | the data to write |
||
timestamp |
number | string |
<optional> |
null | a source timestamp, specified in nanoseconds since midnight, January 1, 1970. Represents a 64-bit value. May be a string if the JavaScript numeric representation would result in a loss of precision. |
Throws:
-
if the sample cannot be written
Returns:
Zero (0).
- Type
- number
writeReliable(data, timestampopt) → {external:Promise.<number>}
Asynchronously writer a DDS sample.
This method returns a Promise that resolves with a value of zero (0) once the write has completed. If an error occurs, the promise rejects with a DDSError.
When a writer's reliability QoS policy is set to kind Reliable write operations my block while the DDS system attempts to ensure delivery of the sample. This method may be called on all writer's, regardless of the specified reliability policy.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
data |
object | the data to write |
||
timestamp |
number | string |
<optional> |
null | a source timestamp, specified in nanoseconds since midnight, January 1, 1970. Represents a 64-bit value. May be a string if the JavaScript numeric representation would result in a loss of precision. |
Returns:
- Type
- external:Promise.<number>
Example
const dds = require('vortexdds');
const wr = somePreviouslyCreatedWriter;
const data = {
id: 1,
message: 'hello world!',
};
wr.writeReliable(data)
.then(_ => {
// do any actions required after
// a successful write
})
.catch(err => {
// write was unsuccessful
});