OpenSplice DDS Tutorial -- Part II

2,503 views
2,211 views

Published on

The Data Distribution Service (DDS) is a standard for efficient and ubiquitous data sharing built upon the concept of a, strongly typed, distributed data space. The ability to scale from resource constrained embedded systems to ultra-large scale distributed systems, has made DDS the technology of choice for applications, such as, Power Generation, Large Scale SCADA, Air Traffic Control and Management, Smart Cities, Smart Grids, Vehicles, Medical Devices, Simulation, Aerospace, Defense and Financial Trading.

This two part webcast provides an in depth introduction to DDS – the universal data sharing technology. Specifically, we will introduce (1) the DDS conceptual model and data-centric design, (2) DDS data modeling fundamentals, (3) the complete set of C++ and Java API, (4) the most important programming, data modeling and QoS Idioms, and (5) the integration between DDS and web applications.

After attending this webcast you will understand how to exploit DDS architectural features when designing your next system, how to write idiomatic DDS applications in C++ and Java and what are the fundamental patterns that you should adopt in your applications.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,503
On SlideShare
0
From Embeds
0
Number of Embeds
54
Actions
Shares
0
Downloads
110
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

OpenSplice DDS Tutorial -- Part II

  1. 1. OpenSplice | DDS Tutorial -- Part II -Angelo CORSARO, Ph.D. Chief Technology Officer OMG DDS Sig Co-Chair PrismTech angelo.corsaro@prismtech.com
  2. 2. Part I Recap
  3. 3. DDS is a standard technology for ubiquitous, interoperable, secure, platform independent, and real-time data sharing across network connected devices
  4. 4. Data Distribution Service (DDS) • DDS’ Global Data Space is fully distributed, highly efficient and scalable Data Writer QoS Data Writer TopicD Data Reader QoS TopicA Data Writer QoS QoS TopicC Data Reader TopicB ... Data Writer Data Reader DDS Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. • DDS provides a Global Data Space abstraction that allow applications to autonomously, anonymously, securely and efficiently share data Data Reader
  5. 5. DDS Entities Domain (e.g. Domain 123) Domain Participant Topic Partition (e.g. “Telemetry”, “Shapes”, ) Topic Instances/Samples Ta • • • • Tb Publisher Subscriber Tx Ty Tc DataWrter DataReader DomainParticipant: Provides access to a data cloud -- called a domain in DDS Topic: Domain-wide definition of a kind of Information Publisher/Subscriber: Provide scope to data sharing through the concept of partitions DataReader/DataWriter: Allow to read/write data for a given topic in the partitions their Subscriber/Publisher are associated with. Copyright  2013,  PrismTech  –    All  Rights  Reserved. T1 T1 T3
  6. 6. Part II
  7. 7. Quality of Service
  8. 8. QoS Model • QoS-Policies control local and endto-end properties of DDS entities Type Matching Local properties controlled by QoS are related resource usage QoS matching QoS QoS QoS • • Some QoS-Policies are matched based on a Request vs. Offered (RxO) Model QoS QoS Topic Name Publisher End-to-end properties controlled by QoS are related to temporal and spatial aspects of data distribution QoS QoS ... DataWriter writes Type reads Subscriber DataReader ... ... DomainParticipant DataWriter writes Type reads DataReader DomainParticipant Name Topic QoS QoS QoS Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  9. 9. QoS Policies [T: Topic] [DR: DataReader] [DW: DataWriter] [P: Publisher] [S: Subscriber] Applicability RxO Modifiable USER_DATA DP, DR, DW N Y TOPIC_DATA T N Y GROUP_DATA P, S N Y DURABILITY T, DR, DW Y N DURABILITY SERVICE T, DW N N HISTORY T, DR, DW N N PRESENTATION P, S Y N RELIABILITY T, DR, DW Y N PARTITION P, S N Y DESTINATION ORDER T, DR, DW Y N LIFESPAN T, DW N Y Configuration Data Availability Data Delivery Copyright  2013,  PrismTech  –    All  Rights  Reserved. QoS Policy [DP: Domain Participant]
  10. 10. QoS Policies [T: Topic] [DR: DataReader] [DW: DataWriter] [P: Publisher] [S: Subscriber] QoS Policy Applicability RxO Modifiable DEADLINE T, DR, DW Y Y LATENCY BUDGET T, DR, DW Y [DP: Domain Participant] Y Temporal/ Importance Characteristics T, DW N Y TIME BASED FILTER DR N Y OWNERSHIP T, DR, DW Y N OWNERSHIP STRENGTH DW N Y Replication LIVELINESS T, DR, DW Y N Fault-Detection Copyright  2013,  PrismTech  –    All  Rights  Reserved. TRANSPORT PRIORITY
  11. 11. QoS DSL • • The ISO C++ and Java 5 APIs provide DSL for dealing with QoS Policies configuration • Policies as well as Entity QoS are immutable — this allows for better safety and object sharing • Policies are treated as algebraic data types and the DSL provide constructors of each of the cases • A QoS Provider can now be used to retrieve QoS settings from external sources, e.g. a file, an HTTP server, DDS durability Copyright  2013,  PrismTech  –    All  Rights  Reserved. The DSL uses language specific idioms, such as fluid interfaces, as well as specific features of the languages
  12. 12. C++ QoS Policy DSL //      ==  ISO  C++  DDS  API  ==   ! ! DataWriterQos  dwqos  =  pub.default_datawriter_qos()     !    <<  History.KeepLast(10)      <<  Durability.Transient();   Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  13. 13. Java 5 QoS Policy DSL //      ==  Java  5  DDS  API  ==   ! final  PolicyFactory  pf  =  ...   ! DataWriterQos  dwqos  =  pub.getDefaultDataWriterQos()   !   .withPolicies  (       pf.History.withKeepLast(10),       pf.Durability.withTransient(),      );   ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  14. 14. Data Delivery Reliability Data Delivery Presentation Copyright  2013,  PrismTech  –    All  Rights  Reserved. Partition Destination Order
  15. 15. Reliability QoS Policy The Reliability Policy controls the level of guarantee offered by the DDS in delivering data to subscribers • Best Effort. Indicates that it is acceptable not to retry propagation of samples Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Reliable. In steady-state, and with no data writer crashes, guarantees that all samples in the DataWriter history will eventually be delivered to all the DataReader QoS Policy Applicability RxO Modifiable RELIABILITY T, DR, DW Y N
  16. 16. Setting Reliability Policy //      ==  ISO  C++  DDS  API  ==   ! //  Reliable  Reliability   DataWriterQos  dwqos  =     !      pub.default_datawriter_qos()  <<  Reliability.Reliable();   ! //  Best-­‐Effort  Reliability   DataWriterQos  dwqos  =          pub.default_datawriter_qos()  <<  Reliability.BestEffort();   Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  17. 17. Setting Reliability Policy //      ==  Java  5  DDS  API  ==   ! final  PolicyFactory  pf  =  ...   ! //  Reliable  Reliability   DataWriterQos  dwqos  =     !      pub.getDefaultDataWriterQos()   !            .withPolicies(pf.Reliability.withReliable());     //  Best-­‐Effort  Reliability   DataWriterQos  dwqos  =          pub.getDefaultDataWriterQos()              .withPolicies(pf.Reliability.withBestEffort());     Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  18. 18. Partitions • Partitions are the mechanism provided by DDS to organise information within a domain • • Access to partitions is controlled through QoS Policies • “system:telemetry”   • “system:log”   • “data:row-­‐2:col-­‐3”   • Partitions addressed by name or regular expressions: • • “data:row-­‐2:col-­‐*” ”system:telemetry”   Partitions Copyright  2013,  PrismTech  –    All  Rights  Reserved. Partitions are defined as strings:
  19. 19. Partition QoS Policy The Partition QoS Policy can be used as subjects for organising the flows of data • The Partition QoS Policy is used to connect Publishers/Subscribers to a Partitions’ List which might also contain wildcards, e.g. tracks.* • Topics instances are published and subscribed across one or more Partitions Partitions Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  20. 20. Setting Partition QoS Policy //      ==  ISO  C++  DDS  API  ==   ! //  Setting  a  Partition   PublisherQos  pqos  =     !      dp.default_publisher_qos()  <<  Partition(“MyPartition”);   ! //  Setting  a  List  of  Partitions   PublisherQos  pqos  =          dp.default_publisher_qos()  <<  Partition(myPartitionList); Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  21. 21. Setting Partition QoS Policy //      ==  Java  5  DDS  API  ==   ! final  PolicyFactory  pf  =  ...   ! //  Setting  a  Partition   PublisherQos  pqos  =     !      dp.getDefaultPublisherQos()   !            .withPolicies(pf.Partition(“MyPartition”));     //  Setting  a  List  of  Partitions   PublisherQos  pqos  =          dp.getDefaultPublisherQos()              .withPolicies(pf.Partition(myPartitionList));     Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  22. 22. Data Availability History Durability Ownership Ownership Strength Copyright  2013,  PrismTech  –    All  Rights  Reserved. Lifespan Data Availability
  23. 23. History QoS Policy 3 time 2 time 3 4 e ssur Pre KeepLast(3) The DataWriter HISTORY QoS Policy controls the amount of data that can be made available to late joining DataReaders under TRANSIENT_LOCAL Durability The DataReader HISTORY QoS Policy controls how many samples will be kept on the reader cache • Keep Last. DDS will keep the most recent “depth” samples of each instance of data identified by its key • Keep All. The DDS keep all the samples of each instance of data identified by its key -- up to reaching some configurable resource limits time KeepAll QoS Policy HISTORY Applicability T, DR, DW RxO N Modifiable N Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0 KeepLast(1)
  24. 24. Durability QoS Policy The DURABILITY QoS controls the data availability w.r.t. late joiners, specifically the DDS provides the following variants: • • Volatile. No need to keep data instances for late joining data readers • • Transient. Data instance availability outlives the data writer Copyright  2013,  PrismTech  –    All  Rights  Reserved. Transient Local. Data instance availability for late joining data reader is tied to the data writer availability Persistent. Data instance availability outlives system restarts QoS Policy Applicability DURABILITY T, DR, DW RxO Y Modifiable N
  25. 25. Volatile Durability Data Writer QoS TopicA • • Data Reader No Time Decoupling Readers get only data produced after they joined the Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  26. 26. Volatile Durability Late Joiner ! ! Data Reader Data Writer QoS TopicA Data Reader • • No Time Decoupling Readers get only data produced after they joined the Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  27. 27. Volatile Durability Late Joiner ! ! Data Reader Data Writer 2 QoS TopicA Data Reader • • No Time Decoupling Readers get only data produced after they joined the Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  28. 28. Transient Local Durability Data Writer QoS TopicA • • Data Reader Some Time Decoupling Data availability is tied to the availability of the data writer and the history settings Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  29. 29. Transient Local Durability Late Joiner ! ! Data Reader Data Writer 1 QoS TopicA Data Reader • • Some Time Decoupling Data availability is tied to the availability of the data writer and the history settings Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  30. 30. Transient-Local Durability Data Reader Data Writer 1 2 1 QoS TopicA Data Reader • • Some Time Decoupling Data availability is tied to the availability of the data writer and the history settings Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  31. 31. Transient Durability Data Writer QoS TopicA 1 • • Time Decoupling Data availability is tied to the availability of the durability service Data Reader Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  32. 32. Transient Durability Late Joiner ! ! Data Reader Data Writer QoS TopicA Data Reader 1 • • Time Decoupling Data availability is tied to the availability of the durability service Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  33. 33. Transient Durability Data Reader Data Writer 1 2 QoS TopicA 2 Data Reader 1 • • Time Decoupling Data availability is tied to the availability of the durability service Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1
  34. 34. Transient Durability Data Reader 2 1 QoS TopicA 1 2 • • Time Decoupling Data availability is tied to the availability of the durability service 1 Copyright  2013,  PrismTech  –    All  Rights  Reserved. 2 Data Reader
  35. 35. Transient Durability Data Reader 2 1 QoS TopicA 1 2 1 ! Data Reader ! • • Time Decoupling Late Joiner Data availability is tied to the availability of the durability service Copyright  2013,  PrismTech  –    All  Rights  Reserved. 2 Data Reader
  36. 36. Setting the Durability Policy //      ==  Java  5  DDS  API  ==   ! final  PolicyFactory  pf  =  ...   ! ! //  Setting  TransientLocalDurability   PublisherQos  pqos  =          dp.getDefaultPublisherQos()              .withPolicies(pf.Durability().withTransientLocal());     ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  37. 37. Ownership QoS Policy Availability of data producers can be controlled via two QoS Policies • • • OWNERSHIP (SHARED vs. EXCLUSIVE) • Writer strength is used to coordinate replicated writers Instances of exclusively owned Topics can be modified (are owned) by the higher strength writer QoS Policy OWNERSHIP STRENGTH Applicability T, DR, DW DW RxO Y N Modifiable N Y Copyright  2013,  PrismTech  –    All  Rights  Reserved. OWNERSHIP STRENGTH
  38. 38. Temporal Properties TimeBasedFilter Deadline [Inbound] [Outbound] LatencyBudget Latency TransportPriority Copyright  2013,  PrismTech  –    All  Rights  Reserved. Throughput
  39. 39. Latency Budget • The LATENCY_BUDGET QoS policy specifies the maximum acceptable delay from the time the data is written until the data is inserted in the receiver's application-cache QoS Policy Applicability LATENCY T, DR, DW BUDGET RxO Y Modifiable Y Latency = T1+T2+T3 A non-zero latency-budget allows a DDS implementation to batch samples and improve CPU/Network utilisation DataWriter T3 T1 Batching T2 DataReader Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  40. 40. Deadline QoS Policy The DEADLINE QoS policy defines the maximum inter-arrival time between data samples RxO Y Modifiable Y DataWriter indicates that the application commits to write a new sample at least once every deadline period DataWriter • Applicability T, DR, DW DataReaders are notified when the DEADLINE is violated Deadline Deadline Deadline Deadline Violation Deadline Deadline DataReader Copyright  2013,  PrismTech  –    All  Rights  Reserved. • QoS Policy DEADLINE
  41. 41. Transport Priority QoS Policy QoS Policy Applicability RxO Modifiable TRANSPORT PRIORITY T, DW N Y Copyright  2013,  PrismTech  –    All  Rights  Reserved. • The TRANSPORT_PRIORITY QoS policy is a hint to the infrastructure as to how to set the priority of the underlying transport used to send the data.
  42. 42. Time-Based Filter QoS Policy • The Time Based Filter allows to control the throughput at which data is received by a data reader Samples produced more often than the minimum inter-arrival time are not delivered to the data reader QoS Policy Applicability RxO Modifiable TIME BASED FILTER DR N Y mit Latency = T1+T2+T3 DataWriter T3 DataReader T2 Copyright  2013,  PrismTech  –    All  Rights  Reserved. • mit mit mit mit = minimum inter-arrival time produced sample delivered sample discarded sample
  43. 43. QoS Provider This class allows to externally define policies and decouples the mechanism used to define and access policy definition with policy creation            //  QosProvider...              QosProvider  qos_provider(   !                        "http://www.opensplice.org/demo/config/qos.xml",                          "ishapes-­‐profile");   ! !            DataReader<ShapeType>  dr(sub,  topic,  qos_provider.datareader_qos());   Copyright  2013,  PrismTech  –    All  Rights  Reserved. • • The new C++ and Java APIs introduce the concept of a QoS Provider
  44. 44. Demo: QoS in Action
  45. 45. Shapes Application • The iShapes application is used by DDS vendors to demonstrate some of the basic mechanism as well as product interoperability • Three Topics • One Type struct ShapeType { string color; long x; long y; long shapesize; }; #pragma keylist ShapeType color Spotted shapes represent subscriptions Pierced shapes represent publications Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Circle, Square, Triangle
  46. 46. QoS Idioms
  47. 47. Soft State In distributed systems you often need to model soft-state -- a state that is periodically updated • Examples are the reading of a sensor (e.g. Temperature Sensor), the position of a vehicle, etc. • The QoS combination to model Soft-State is the following: Reliability            =>    BestEffort   Durability              =>    Volatile     History                    =>    KeepLast(n)  [with  n  =  1  in  most  of  the  cases]   Deadline                  =>    updatePeriod   LatencyBudget        =>    updatePeriod/3  [rule  of  thumb]   DestinationOrder  =>    SourceTimestamp  [if  multiple  writers  per  instance] Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  48. 48. Hard State • In distributed systems you often need to model hard-state -- a state that is sporadically updated and that often has temporal persistence requirements • • Examples are system configuration, a price estimate, etc. Reliability            =>    Reliable   Durability              =>    Transient  |  Persistent     History                    =>    KeepLast(n)  [with  n  =  1  in  most  of  the  cases]   DestinationOrder  =>    SourceTimestamp  [if  multiple  writers  per  instance] Copyright  2013,  PrismTech  –    All  Rights  Reserved. The QoS combination to model Hard-State is the following:
  49. 49. Events In distributed systems you often need to model events -- the occurrence of something noteworthy for our system • Examples are a collision alert, the temperature beyond a given threshold, etc. • The QoS combination to model Events is the following: Reliability            =>    Reliable   Durability              =>    any                [depends  on  system  requirements]     History                    =>    KeepAll  [on  both  DataWriter  and  DataReader!]   DestinationOrder  =>    SourceTimestamp Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  50. 50. Accessing the Reader Cache
  51. 51. Reading Samples Samples can be read from the Data Reader History Cache The action of reading a sample is non-destructive. Samples are not removed from the cache DataReader DataReader ... DataReader Cache read ... DataReader Cache Copyright  2013,  PrismTech  –    All  Rights  Reserved. • •
  52. 52. Taking Samples Samples can be taken from the Data Reader History Cache The action of taking a sample is destructive. Samples are removed from the cache DataReader DataReader ... DataReader Cache take ... DataReader Cache Copyright  2013,  PrismTech  –    All  Rights  Reserved. • •
  53. 53. Sample Selectors DDS provides some very flexible mechanisms for selecting the samples to be read/take: • • • Content Status These mechanisms are composable Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  54. 54. Content-Based Selection
  55. 55. Filters and Queries • DDS Filters allow to control what gets into a DataReader cache • DDS Queries allow to control what gets out of a DataReader cache Application Query DataReader Filters are defined by means of ContentFilteredTopics • Filters and Queries are expressed as SQL where clauses DataReader Cache Filter Copyright  2013,  PrismTech  –    All  Rights  Reserved. Queries operate in conjunction with read operations ... • ... ... ... •
  56. 56. // == ISO C++ DDS API ! // Create a Topic auto topic = Topic<ShapeType>(dp, “Circle”); ! // 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) Copyright  2013,  PrismTech  –    All  Rights  Reserved. Filters struct ShapeType { string color; long x; long y; long shapesize; }; #pragma keylist ShapeType color
  57. 57. Filters struct ShapeType { string color; long x; long y; long shapesize; }; #pragma keylist ShapeType color ! final  PolicyFactory  pf  =  runtime.policyFactory();        final  DataReaderQos  drqos  =              sub.getDefaultDataReaderQos()  !                .withPolicy  (   !                          pf.ContentFilter()                                  .withFilter(                                          new  JavaScriptFilter<ShapeType>("data.x  >  data.y"))                    );   ! final  DataReader<ShapeType>  dr  =  sub.createDataReader(shape,  drqos); Copyright  2013,  PrismTech  –    All  Rights  Reserved. //      ==  Java  5DDS  API  ==  
  58. 58. Query struct ShapeType { string color; long x; long y; long shapesize; }; #pragma keylist ShapeType color //      ==  ISO  C++  DDS  API  ==   ! //  Define  filter  expression  and  parameters   ! auto  dr  =  DataReader<ShapeType>(sub,  topic)     val  query  =  Query(dr,  “x  <  100  AND  y  <  200”);   ! ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. dr.select()          .content(query)          .read();
  59. 59. Query struct ShapeType { string color; long x; long y; long shapesize; }; #pragma keylist ShapeType color //      ==  Java  5  DDS  API  ==   ! Filter<ShapeType>  filter  =                                             !      new  JavaScriptFilter<ShapeType>("data.x  >  data.y"))   ! ! ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. dr.select()          .content(filter)          .read();
  60. 60. Instances • DDS provides a very efficient way of reading data belonging to a 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 //      ==  ISO  C++  DDS  API  ==   auto  handle  =     !      dr.lookup_instance(ShapeType(“RED”,  0,  0,  0));   ! auto  data  =              dr.select()              .instance(handle)              .read(); ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  61. 61. State Based Selection
  62. 62. Sample, Instance, and View State The samples included in the DataReader cache have associated some metainformation 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 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 Instance State (ALIVE, NOT_ALIVE_DISPOSED, NOT_ALIVE_NO_WRITERS) allows to track the life-cycle transitions of the instance to which a sample belongs Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  63. 63. State Selector in Action //      ==  ISO  C++  DDS  API  ==   ! //  Read  only  new  samples   auto  data  =  dr.read()   ! ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. ! //  Read  any  samples  from  live  instances   auto  data  =                  dr.select()                    .state(DataState::any_data())                    .read();
  64. 64. State Selector in Action //      ==  Java  5  DDS  API  ==   ! //  Read  only  new  samples   auto  data  =  dr.read()   ! ! Copyright  2013,  PrismTech  –    All  Rights  Reserved. ! //  Read  any  samples  from  live  instances   auto  data  =                  dr.select()                  .dataState(sub.createDataState().withAnySampleState())                  .read();
  65. 65. Putting all Together //      ==  ISO  C++  DDS  API  ==   ! auto  data  =     !      dr.select()   !                .content(query)                  .state(data_state)                  .instance(handle)            .read(); Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Selectors can be composed in a flexible and expressive manner
  66. 66. Application / DDS Interaction Models
  67. 67. Interaction Models Polling • The application proactively polls for data availability as well as special events, such as a deadline being missed, etc. Notice that all DDS API calls, exclusion made for wait operations, are non-blocking Synchronous Notification The application synchronously waits for some conditions to be verified, e.g., data availability, instance lifecycle change, etc. Asynchronous Notification • The application registers the interest to be asynchronously notified when specific condition are satisfied, e.g. data available, a publication matched, etc. Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  68. 68. Synchronous Notifications • DDS provides a mechanism known as WaitSet to synchronously wait for a condition • Condition can predicate on: communication statuses data availability data availability with specific content user-triggered conditions Copyright  2013,  PrismTech  –    All  Rights  Reserved. • • • •
  69. 69. WaitSet //      ==  Java  5  DDS  API  ==   ! //  Create  the  waitset   WaitSet  ws  =  runtime.createWaitSet();   ! Subscriber.DataState  ds  =  sub.createDataState();   ! ! //  Attach  the  condition   ws.attachCondition(c);   ! //  Wait  for  the  condition   ws.wait(); Copyright  2013,  PrismTech  –    All  Rights  Reserved. //  Create  the  condition   ! Condition  c  =  dr.createReadCondition(   !               ds.withAnyViewState()                                        .with(InstanceState.ALIVE)                                        .with(SampleState.NOT_READ));  
  70. 70. Asynchronous Notifications • DDS provides a mechanism known as Listeners for asynchronous notification of a given condition • Listener interest can predicate on: communication statuses data availability Copyright  2013,  PrismTech  –    All  Rights  Reserved. • •
  71. 71. Listener Declaration //      ==  ISO  C++  DDS  API  ==   ! class  ShapeListener  :  public  dds::sub::NoOpDataReaderListener<ShapeType>  {   public:      ShapeListener()  {}      virtual  void  on_data_available(dds::sub::DataReader<ShapeType>&  dr)  {          auto  samples  =  dr.read();          std::for_each(samples.begin(),          samples.end(),   !        [](const  dds::sub::Sample<ShapeType>&  sample)  {     !            if  (sample.info().valid())    //  Check  if  sample  contains  valid  data                  std::cout  <<  sample.data()  <<  std::endl;          });      }   !    virtual  void  on_liveliness_changed(dds::sub::DataReader<ShapeType>&  the_reader,                  const  dds::core::status::LivelinessChangedStatus&  status)        {            std::cout  <<  ">>  Liveliness  Changed!  "  <<  std::endl;      }   };   Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  72. 72. Listener Registration //      ==  ISO  C++  DDS  API  ==   ! auto  l  =  new  ShapeListener();   ! //  Create  a  “nothing”  status  mask   StatusMask  mask  =  StatusMask::none();   ! //  Add  the  statuses  we  are  interested  in.   mask  <<  StatusMask::data_available()              <<  StatusMask::liveliness_changed()              <<  StatusMask::liveliness_lost();     ! //  Register  the  listener  with  the  associated  mask   dr.listener(l,  mask);   Copyright  2013,  PrismTech  –    All  Rights  Reserved. ! !
  73. 73. Common Bootstrap Questions
  74. 74. Can I use C++11? If you want to use C++11 in your DDS applications then you need to enable support for it. Check: • http://dev.opensplice.org/releases/downloads/docs/isocpp/html/ isocpp_customlibs.html Copyright  2013,  PrismTech  –    All  Rights  Reserved. • • OpenSplice default configuration does not require C++11
  75. 75. Which DDS Implementation If you are planning to use C/C++ or C# you may consider OpenSplice DDS • If you are developing Java Applications or are interested in targeting Android then you may consider OpenSplice Mobile Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  76. 76. Where can I find the Java 5 API? The Java 5 API is currently implemented only as part of OpenSplice Mobile • OpenSplice Mobile is a pure Java implementation of DDS Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
  77. 77. Can I “Script” DDS Applications? Assuming you deploy on the JVM then you have two options • Use the DDS Java 5 API through Scala, and then run your scala program as a script • The Molière Scala API for DDS and run the resulting program as a script Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Use the DDS API from JavaScript (or any other script language supported by the JVM) and execute the script through the javax.script.ScriptEngine
  78. 78. How can I Debug my DDS App? OpenSplice DDS • Use the Tuner to inspect entities and QoS OpenSplice Mobile • Use OpenSplice Monitor to inspect entities and QoS Copyright  2013,  PrismTech  –    All  Rights  Reserved. !
  79. 79. Copyright  2013,  PrismTech  –    All  Rights  Reserved. OpenSplice Monitor
  80. 80. Part II Summary & Concluding Remarks
  81. 81. Summary & Remarks • DDS a rich set of QoS to control the key non-functional properties of data • DDS provides idiomatic API which are highly expressive and simple to use Copyright  2013,  PrismTech  –    All  Rights  Reserved. • DDS provides an elegant Data Space abstraction that allows application to share data ubiquitously and efficiently -- the Data Space implementation is fully distributed
  82. 82. :: Connect with Us :: ¥opensplice.com ¥opensplice.org ¥forums.opensplice.org ¥opensplicedds@prismtech.com ¥@acorsaro ¥@prismtech ¥ crc@prismtech.com ¥youtube.com/opensplicetube ¥slideshare.net/angelo.corsaro ¥sales@prismtech.com

×