OpenSplice DDS enables seamless, timely, scalable and dependable data sharing between distributed applications and network-connected devices. Its technical and operational benefits have propelled adoption across multiple industries, such as Defence and Aerospace, SCADA, Gaming, Cloud Computing, Automotive, etc.
If you want to learn about OpenSplice DDS or discover some of its advanced features, this webcast is for you!
In this two-parts webcast we will cover all the aspects tied to architecting and developing OpenSplice DDS systems. We will look into Quality of Services, data selectors concurrency and scalability concerns.
We will present the brand-new, and recently finalized, C++ and Java APIs for DDS, including examples of how this can be used with C++11 features. We will show how, increasingly popular, functional languages such as Scala can be used to efficiently and elegantly exploit the massive HW parallelism provided by modern multi-core processors.
Finally we will present some OpenSplice specific extensions for dealing very high-volumes of data – meaning several millions of messages per seconds.
Gen AI in Business - Global Trends Report 2024.pdf
Advanced OpenSplice Programming - Part I
1. Advanced OpenSplice DDS
Programming
- Part I -
OpenSplice DDS
Angelo CORSARO, Ph.D.
Chief Technology Officer
OMG DDS Sig Co-Chair
PrismTech
angelo.corsaro@prismtech.com
2. Before we get into technical details let’s try to answer two questions:
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
1. What does OpenSplice DDS do?
2. What kind of applications are using it?
OpenSplice DDS
3. OpenSplice DDS enables seamless, loosely-
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
coupled, timely, scalable and dependable
data sharing between distributed applications
OpenSplice DDS
and network connected devices.
4. Some Use Cases
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
OpenSplice DDS
Integrated Modular Vetronics Training & Simulation Systems Naval Combat Systems
Air Traffic Control & Management Unmanned Air Vehicles Aerospace Applications
5. Some Use Cases
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
OpenSplice DDS
Agricultural Vehicle Systems Large Scale SCADA Systems Smart Cities
Train Control Systems Complex Medical Devices Big Data (In-Memory) Analytics
8. Data in Programming Languages
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ Statically Typed Programming Languages provide mechanisms to
declare a variable for given type as well as defining new types
OpenSplice DDS
int
x;
class
Rational
{
...
}
☐ Scoping rules are then used to define what values and types are
accessible at any given point in a program text
9. “Local” Data
☐ Consider the Following code fragment below in an imperative
programming language:
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
State
1 { 1
{
}
2
int
x; 2
{
int
x
}
3
x
=
7; 3
{
x
=
7
}
OpenSplice DDS
4
{ 4
{
x
=
7,
{
}
}
5
int
y; 5
{
x
=
7,
{
int
y
}
}
6
y
=
18; 6
{
x
=
7,
{
y
=
18
}
}
7
double
z; 7
{
x
=
7,
{
y
=
18,
double
z
}
}
8
z
=
3.141593 8
{
x
=
7,
{
y
=
18,
z
=
3.1416
}
}
9
x
=
x
-‐
4; 9
{
x
=
3,
{
y
=
2
}
}
10
y
=
x
+
y; 10
{
x
=
3,
{
y
=
21
}
}
11
z
=
2
*
z
*
y; 11
{
x
=
3,
{
y
=
21,
z
=
131.9472
}
}
12
} 12
{
x
=
3,
{
}}
13 } 13
{
}
10. “Local” Data
☐ One final consideration to do is that variables in a programming
language are in essence alias to a memory location
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
int
x;
int
y;
OpenSplice DDS
...
11. Distributed Data
Extending the elegant model provided by programming
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐
languages to distributed systems has been and still is a quite
popular research topic
OpenSplice DDS
☐ Historically the solutions to the distributed data problem where
divided into those based on Distributed Shared Memory and those
based on Message Passing
☐ OpenSplice DDS provide a new interesting way of addressing this
problem. Let’s see...
13. Distributed Data in OpenSplice
☐ OpenSplice DDS provides the abstraction
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
of an “Active” Global Data Space
☐ The Global Data Space is fully distributed TopicA
and does not suffer Single Point of Failure TopicE
OpenSplice DDS
issues TopicB
...
TopicD
☐ Applications can autonomously join and TopicC
leave this data space as well as declare
new “Data Types”
OpenSplice DDS Global Data Space
☐ In OpenSplice, “data types” are called
Topics
14. Global Data Space
☐ The Global Data Space is actually called “Domain” in
OpenSplice DDS
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ Domains are identified by integer. An application
can join a domain by creating a domain participant
as follows: TopicA
TopicE
OpenSplice DDS
//
Create
a
Topic ...
int
domain_id
=
18; TopicB
TopicD
auto
dp
=
DomainParticipant(domain_id);
TopicC
☐ A Domain defines a top-level scope thus the
content of a domain is not accessible from
OpenSplice DDS Global Data Space
another domain
☐ Finally an application can join multiple domains
by creating one domain participant per-domain
15. Topics
☐ A Topic is defined by means of a “Circle”, Square”, “Triangle”
(name, type, qos) tuple, where
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ name: identifies the topic within
Name
OpenSplice’s Global Data Space
Topic
☐ type: is the programming language
Typ
S
OpenSplice DDS
DURABILITY,
Qo
type associated with the topic. This
e
DEADLINE,
type can be defined in IDL, XML, and ShapeType
PRIORITY,
Java. Types are extensible and …
evolvable
☐ qos: is a collection of policies that struct ShapeType {
string color;
control non-functional properties of long x;
this topic, such as its durability, long
long
y;
size;
reliability, etc. };
16. Defining a Topic
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ In code, if we wanted to define the Square topic we would do
(with the new DDS-PSM-Cxx v1.0 API):
// Create a Topic
OpenSplice DDS
auto dp = DomainParticipant(18);
auto topic = Topic<ShapeType>(dp, “Square”, dp.default_topic_qos());
// Or equivalently and more concisely:
auto topic = Topic<ShapeType>(dp, “Square”);
☐ The effect of this code is to define a topic called “Square” with
type ShapeType and default QoS within the OpenSplice Global
Data Space
17. Looking with the Spyglass
domain 18
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
&&long&&&size;
};
Policies
auto topic = Topic<ShapeType>(dp, “Square”);
18. Topics Scope
☐ Topic definitions are (somewhat) equivalent to type definitions in a programming
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
language. In the sense that they define a new, generalized, type to be used
within the global data space
☐ The scope of a Topic definition is the entire Domain, thus one could say that
there is only one level of scoping. To make the parallel with Java, one could say
OpenSplice DDS
that it is as if Topics where defined in a namespace named after the domain-id
domain0
{TopicA,
TopicB,
...}
domain1
{Topic1,
Topic2,
...}
☐ As a consequence topic definitions in one domain are not visible from a
different domain
19. If Topic are Types what are Variables?
☐ As described earlier a Topic definition can be thought as a Type
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
definition in a programming language
☐ In a statically typed programming language (e.g. Java), given a
type Foo I can define a variable of type Foo as:
OpenSplice DDS
Foo
x;
☐ Then I can initialize it as: x
=
new
Foo(...);
☐ Then I can mutate it, by: x.setBar(...);
☐ How are instance of a Topic defined?
20. DataWriter
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ OpenSplice DDS uses DataWriters to declare and write
instances of a Topic
☐ A DataWriter for our Square topic can be defined as follows:
OpenSplice DDS
// Create a Publisher
auto pub = Publisher(dp);
// Create a DataWriter
auto dw = DataWriter<ShapeType>(pub, topic);
// Write data
dw.write(ShapeType(“RED”,11,77,99));
21. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
dw &&long&&&size;
};
Policies
color x y size
auto dw = DataWriter<ShapeType>(pub, topic);
22. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
dw &&long&&&size;
};
Policies
color x y size
"RED" 11 77 99
dw.write(ShapeType(“RED”,11,77,99));
23. An Experiment...
☐ What does the following code do?
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
// Create a Publisher
auto pub = Publisher(dp);
// Create DataWriters
auto dw1 = DataWriter<ShapeType>(pub, topic);
OpenSplice DDS
auto dw2 = DataWriter<ShapeType>(pub, topic);
// Write Data
dw1.write(ShapeType(“RED”,10,20,30));
dw2.write(ShapeType(“BLUE”,30,20, 10));
24. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
&&long&&&size;
};
dw1 Policies
Data Writers for the same topic
color x y size are aliased to the same variable!
dw2
auto dw1 = DataWriter<ShapeType>(pub, topic);
auto dw2 = DataWriter<ShapeType>(pub, topic);
25. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
&&long&&&size;
};
dw1 Policies
color x y size
RED 10 20 30
dw2
dw1.write(ShapeType(“RED”,10,20,30));
26. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
&&long&&&size;
};
dw1 Policies
color x y size
BLUE 30 20 10
dw2
dw2.write(ShapeType(“BLUE”,30,20, 10));
27. Topic Instances
☐ Topic type can identify an arbitrary number of attributes as defining the
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
topic key
☐ In this case, each unique key value defines a topic instance
☐ Example:
OpenSplice DDS
struct ShapeType {
@Key
long color;
long x;
long y;
long size;
};
28. Let’s Experiment...
☐ What does the following code do?
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
// Create a Publisher
auto pub = Publisher(dp);
// Create DataWriters
OpenSplice DDS
auto dw = DataWriter<ShapeType>(pub, topic);
// Write Data
dw.write(ShapeType(“RED”,10,20,30));
dw.write(ShapeType(“BLUE”,30,20,10));
29. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
dw &&long&&&size;
};
Policies
color x y size
RED 10 20 30
dw.write(ShapeType(“RED”,10,20,30));
30. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Square
struct&ShapeType&{
&&string&&&color;&&&&&&
&&long&&&x;&&&
&&long&&&y;
OpenSplice DDS
dw &&long&&&size;
};
Policies
color x y size
RED 10 20 30
BLUE 30 20 10
dw.write(ShapeType(“BLUE”,30,20,10));
31. LongVariable Example
☐ The “distributed” version of the following code:
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
int
x;
int
y;
x
=
10;
y
=
20;
OpenSplice DDS
Topic Type
☐ Becomes:
// Create a Publisher struct LongVariable {
auto lvt = Topic<LongVariable>(dp, “TLongVariable”); @Key
string name;
// Create DataWriters long value;
auto dw = DataWriter<LongVariable>(pub, topic); };
// Write Data
dw.write(LongVariable(“x”,10));
dw.write(LongVariable(“y”,20));
32. Looking with the Spyglass
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
TLongValue
struct LongVariable {
@Key
string name;
long value;
OpenSplice DDS
dw };
Policies
name value
x 10
y 20
33. DataReader
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ OpenSplice DDS uses DataReaders to read instances of a Topic
☐ A DataReader for our Square topic can be defined as follows:
OpenSplice DDS
// Create a Subscriber
auto sub = Subscriber(dp);
// Create a DataWriter
auto dr = DataReader<ShapeType>(sub, topic);
// Read data
auto data = dr.read();
☐ The read operation will read by default all instance values. Special selector
operation are available to pick a specific instance. More later
34. DataReader/DataWriter Matching
☐ DataWriters and DataReaders
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
are automatically and
dynamically matched by the Data
Reader
DDS Dynamic Discovery
Data
Writer
OpenSplice DDS
Data
Reader
☐ A rich set of QoS Policies Data
Writer
TopicA
TopicD
allows to control existential, TopicB
Data
Reader
temporal, and spatial
Data
Writer
TopicC
...
properties of data and Data Data
impacts DataReader/ Writer Reader
DataWriter matching DDS Global Data Space
36. Publishers / Subscribers
Domain (e.g. Domain 123)
Domain
Participant
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Topic
Partition (e.g. “Telemetry”, “Shapes”, )
T1 Publisher
T1 T3 Subscriber
Tx
OpenSplice DDS
Topic Instances/Samples
Ty
Tb
Ta DataWrter DataReader
Tc
Publishers and Subscribers in DDS play two roles:
☐ Coordinate actions across DataReaders/DataWriters
☐ e.g. Atomic writes across data-writers
☐ Control access to DDS partitions, a mechanism provided by DDS to further
37. DDS Partitions
Domain
Partitions DDS Publishers and
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐
Subscribers can specify a
M:0:0 M:0:1 M:0:2 list of regular expressions
representing the partitions
OpenSplice DDS
to join
M:1:0 M:1:1 M:1:2
☐ Actual partition can be
any string, but some
M:2:0 M:2:1 M:2:2 structure can be given in
order mimic hierarchy
42. Anatomy of a DDS Application
[DDS C++ API 2010]
Domain
Domain
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
auto dp = DomainParticipant(domainId);
Participant
Session
// Create a Topic
Publisher
Topic
Subscriber
OpenSplice DDS
auto topic = Topic<ShapeType>(dp, “Circle”);
// Create a Publisher / Subscriber
auto pub = Publisher(dp);
auto sub = Subscriber(dp);
Reader/Writers for User Defined for Types DataWriter
DataReader
// Create a DataWriter/DataWriter
auto writer = DataWriter<ShapeType>(pub, topic); Reader/Writer for
auto reader = DataReader<ShapeType>(sub, topic);
application defined
Topic Types
43. Anatomy of a DDS Application
[DDS C++ API 2010]
Domain
Domain
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
auto dp = DomainParticipant(domainId);
Participant
Session
// Create a Topic
Publisher
Topic
Subscriber
OpenSplice DDS
auto topic = Topic<ShapeType>(dp, “Circle”);
// Create a Publisher / Subscriber
auto pub = Publisher(dp);
auto sub = Subscriber(dp);
Reader/Writers for User Defined for Types DataWriter
DataReader
// Write data
writer.write(ShapeType(“RED”, 131, 107, 89)); Reader/Writer for
// But you can also write like this...
writer << ShapeType(“RED”, 131, 107, 89);
application defined
Topic Types
// Read new data (loaned)
auto data = reader.read();
58. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
QoS Policies
‣ History
‣ Destination Order Network
‣ Presentation
‣ Partition QoS Policies
‣ Time Based Filter ‣ Reliability ‣ Durability
‣ Ownership ‣ History ‣ Transport Priority
‣ Latency Budget ‣ Time Based Filter
59. Writer Cache Properties
☐ An entry for each topic instance
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ Each cache entry might contain one
or more samples, the number of
DataWriter
samples is controlled by the History
QoS Policy
OpenSplice DDS
...
☐ Depending on the setting of the
Durability QoS Policy, the content of
the cache may be made available DataWriter Cache
to late joiners. The depth of the
cache controls how many samples
per instance will be delivered to late
joiners
60. Reader Cache Properties
☐ An entry for each topic instance
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ Each cache entry might contain one or
more samples, the number of samples is
controlled by the History QoS Policy DataReader
☐ History.KeepLast(n) keeps the last n samples
OpenSplice DDS
per instance
☐ History.KeepAll maintains all the samples,
...
modulo resource constraints
☐ For a given instance: DataReader Cache
☐ Samples from the same writer are inserted in
write-order
☐ Samples from multiple-writers are ordered
using time-stamps (source or reception
depending on configurable a QoS Policy)
61. Eventual Consistency
DDS caches provide eventual consistency semantics
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐
☐ This means that a read will see the effect of a preceding write
eventually
OpenSplice DDS
☐ Furthermore, given a data-writer that is currently matching N
readers, we can think of DDS as providing eventual consistency
with W=0 and R=1
☐ W: the number of Acks expected in order to return from a write
☐ R: the number of sources from which a read access data
63. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
64. Reader/Writer Caches
write( 1 ) Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
65. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
1
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
66. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
1
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
1 Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
67. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
1 1 1
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
68. Reader/Writer Caches
write( 2 ) Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
1 1 1
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
69. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
2 1 1
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
70. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
2 1 1
...
OpenSplice DDS
DataWriter Cache DataReader Cache DataReader Cache
2 Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
71. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
2 1 1
...
OpenSplice DDS
2 2
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
72. Reader/Writer Caches
write( 3 ) Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
2 1 1
...
OpenSplice DDS
2 2
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
73. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
3 1 1
...
OpenSplice DDS
2 2
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
74. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
3 1 1
...
OpenSplice DDS
2 2
DataWriter Cache DataReader Cache DataReader Cache
3 Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
75. Reader/Writer Caches
Application Application Application
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
DataWriter DataReader DataReader
3 2 2
...
OpenSplice DDS
3 3
DataWriter Cache DataReader Cache DataReader Cache
Network
Assumptions: DataReader configured with history depth of 2 and
DataWriter with default history depth of 1
77. Dynamic View of a Stream
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
OpenSplice DDS
...
Stream: Set of samples written over
time for a given topic instance.
78. Eventual View of a Stream
Assumptions (Default Settings):
Reader History = KeepLast (1)
WriterHistory = KeepLast (1)
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Writer History
Reader History ‘Past’ Samples
OpenSplice DDS
Stream: Set of samples written over
time for a given topic instance.
79. Eventual View of a Stream
Assumptions:
Reader History = KeepLast (n) with n > 1
WriterHistory = KeepLast (1)
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Writer History Reader History
‘Past’ Samples
OpenSplice DDS
Stream: Set of samples written over
time for a given topic instance.
80. Eventual View of a Stream
Assumptions:
Reader History = KeepLast (n) with n > 1
WriterHistory = KeepLast (m) with n > m > 1
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Writer History Reader History
‘Past’ Samples
OpenSplice DDS
Stream: Set of samples written over
time for a given topic instance.
81. Eventual View of a Stream
Assumptions:
Reader History = KeepAll
WriterHistory = KeepLast (m) with n > m > 1
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Writer History Reader History
OpenSplice DDS
...
83. Reading Data Samples
☐ Samples can be read from the Data Reader History Cache
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ The action of reading a sample is non-destructive. Samples are
not removed from the cache
OpenSplice DDS
DataReader DataReader
... read ...
DataReader Cache DataReader Cache
84. Taking Data Samples
☐ Samples can be taken from the Data Reader History Cache
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ The action of taking a sample is destructive. Samples are
removed from the cache
OpenSplice DDS
DataReader DataReader
... take ...
DataReader Cache DataReader Cache
85. Read vs. Take
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ The read operation should always be access the latest know value
for topics that represent distributed state
OpenSplice DDS
☐ The take operation should be used to get the last notification from a
topic that represent an event
87. Cherry Picking in DDS
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ DDS provides some very flexible mechanisms for selecting the data
to be read:
OpenSplice DDS
☐ Data Content
☐ Data Status
☐ These mechanisms are composable
89. Filters and Queries Application
☐ DDS Filters allow to control what gets
into a DataReader cache
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Query
☐ DDS Queries allow to control what gets
out of a DataReader cache DataReader
OpenSplice DDS
☐ Filters are defined by means of
...
ContentFilteredTopics
...
...
...
☐ Queries operate in conjunction with DataReader Cache
read operations
Filter
☐ Filters and Queries are expressed as SQL
where clauses
90. struct ShapeType {
Filters
@Key
string color;
long x;
long y;
[C++ API] };
long shapesize;
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
/**
* NOTE: The Scala API if not provided with DP/Sub/Pub assumes
* default domains and default partition.
**/
// Create a Topic
auto topic = Topic<ShapeType>(dp, “Circle”);
OpenSplice DDS
// Define filter expression and parameters
auto filter = Filter(“x < 100 AND y < 200”);
// Define content filtered topic
auto cftopic =
ContentFilteredTopic<ShapeType>(“CFCircle”, topic, filter)
// Create a DataReader for the content-filtered Topic
auto dr = DataReader<ShapeType>(sub,cftopic)
91. struct ShapeType {
Query
@Key
string color;
long x;
long y;
[C++ API] };
long shapesize;
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
// Define filter expression and parameters
auto dr = DataReader<ShapeType>(sub, topic)
OpenSplice DDS
val query = Query(dr, “x < 100 AND y < 200”);
dr.select()
.content(query)
.read();
92. Instances
☐ DDS provides a very efficient way of reading data belonging to a
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
specific Topic Instance
☐ Obviously, one could use queries to match the key’s value, but this
is not as efficient as the special purpose instance selector
OpenSplice DDS
auto handle =
dr.lookup_instance(ShapeType(“RED”, 0, 0, 0));
auto data =
dr.select()
.instance(handle)
.read();
94. Sample, Instance, and View State
☐ The samples included in the DataReader cache have associated
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
some meta-information which, among other things, describes the
status of the sample and its associated stream/instance
☐ The Sample State (READ, NOT_READ) allows to distinguish between
OpenSplice DDS
new samples and samples that have already been read
☐ The View State (NEW, NOT_NEW) allows to distinguish a new
instance from an existing one
☐ The Intance State (ALIVE, NOT_ALIVE_DISPOSED,
NOT_ALIVE_NO_WRITERS) allows to track the life-cycle transitions of
the instance to which a sample belongs
95. State Selector in Action
[C++ API]
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
// Read only new samples
auto data = dr.read()
// Read any samples from live instances
auto data =
dr.select()
OpenSplice DDS
.state(DataState::any_data())
.read();
96. Putting all Together
[C++ API]
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ Selectors can be composed in a flexible and expressive manner
OpenSplice DDS
auto data =
dr.select()
.content(query)
.state(data_state)
.instance(handle)
.read();
98. Concluding Remarks
OpenSplice DDS provides a very powerful abstraction for building
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐
distributed applications grounded on the concept of a fully
distributed global data space
OpenSplice DDS
☐ Topics are used to define the types that populate the global data
space while DataWriters and DataReaders are used to produce
and consume values
☐ DataReaders allow very flexible data access through cache
access operations