DDS for JMS Programmers
-
Upload
angelo-corsaro -
Category
Technology
-
view
3.436 -
download
10
description
Transcript of DDS for JMS Programmers
Angelo Corsaro, Ph.D. Chief Technology Officer!OMG DDS Sig Co-Chair PrismTech [email protected]!
Standards Scopes
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Standards Compared
DDS Standard v1.2
¨ Programming Language Independent API for Data-Centric Pub/Sub
¨ Interoperable Wire-Protocol (DDSI/RTPS)
JMS Standard v1.1
¨ Java Messaging API (Pub/Sub + PTP) portable across messaging implementations
2004 2001
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Standards Compared ¨ DDS ensures portability and
interoperability across implementation of the standard
¨ JMS focuses only on application portability across implementation of the standard
DDSI
DDS API
Application
Standard
Application
JMS API
JMS Provider
Standard
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Standards Compared
DDS Standard
¨ Promotes Fully Distributed Architectures
¨ Provides mechanisms for transparently using Brokers/Routers
JMS Standard
¨ Promotes Hub and Spoke Architectures
¨ Fully distributed architectures are possible but complicated by some use cases
Standardization "Activity
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
JMS
¨ The JMS standard has not been evolving after the v1.1 released in 2002
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App
2004
Standard API
§ Standard API for Data-
Centric Real-Time Pub/Sub § Automatic fail-over § Persistence § Dynamic Discovery § Content Filtering / Queries
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
DDSI/RTPS network
Interoperable Wire Protocol
2004
2006
DDS
App
DDSI/RTPS
2004
2006
§ High Performance § Interoperable Wire Protocol
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
DDSI/RTPS network
Interoperable Wire Protocol
UML4DDS
2004
2006
2008
DDS
App
DDSI/RTPS
2004
2006
UML4DDS 2008
§ UML-Based Modeling of DDS applications
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
DDSI/RTPS network
Interoperable Wire Protocol
UML4DDS
2004
2006
2008
X-T
ype
s 20
10
DDS
App
DDSI/RTPS
UML4DDS
2004
2006
2008
X-T
ype
s 20
10
§ Extensible/Evolvable Type System
§ Dynamic Topic Types, Data Readers & Writers
§ Encoding Negotiation
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
DDSI/RTPS network
Interoperable Wire Protocol
UML4DDS
ISO-C++ PSM 2010 2004
2006
2008
X-T
ype
s 20
10
DDS
App
DDSI/RTPS
UML4DDS
2004
2006
2008
X-T
ype
s 20
10
§ ISO C++ DDS PSM § Simple, Safe, Efficient,
Elegant and Ergonomic API
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
DDSI/RTPS network
Interoperable Wire Protocol
UML4DDS
ISO-C++ PSM 2010
Java5 PSM 2010 2004
2006
2008
X-T
ype
s 20
10
DDS
App
DDSI/RTPS
UML4DDS
2004
2006
2008
X-T
ype
s 20
10
§ Java 5 DDS PSM § Simple, Safe, Efficient,
Elegant and Ergonomic API
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
DDSI/RTPS network
Interoperable Wire Protocol
UML4DDS
ISO-C++ PSM 2010
Java5 PSM 2010 2004
2006
2008
X-T
ype
s 20
10
DDS
App
DDSI/RTPS
UML4DDS
2004
2006
2008
X-T
ype
s 20
10
We
b-D
DS
2011
We
b-D
DS
2011
§ Standardized way of accessing DDS from Web Technologies
§ REST, W3C WS-*, RSS, etc.
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Standard Evolution
DDS
App Standard API
ULS-DDSI network
Interoperable Wire Protocol
UML4DDS
ISO-C++ PSM 2010
Java5 PSM 2010 2004
2011
2008
X-T
ype
s 20
10
DDS
App
ULS-DDSI
UML4DDS
2004
2011
2008
X-T
ype
s 20
10
We
b-D
DS
2011
We
b-D
DS
2011
§ Ultra-Large Scale Extensions to the DDSI/RTPS wire-protocol
§ New Discovery § Support for TCP, etc.
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
ULS-DDSI ULS-DDSI
DDS Standard Evolution
DDS
App Standard API
network
Interoperable Wire Protocol
UML4DDS
ISO-C++ PSM 2010
Java5 PSM 2010 2004
2011
2008
X-T
ype
s 20
10
DDS
App
UML4DDS
2004
2011
2008
X-T
ype
s 20
10
We
b-D
DS
2011
We
b-D
DS
2011
§ Interoperable Security Architecture
§ Pluggable Policy / Labeling and Tagging
Sec
urity
20
12
Sec
urity
20
12
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
ULS-DDSI ULS-DDSI
DDS Standard Evolution
DDS
App
Standard API
network
Interoperable Wire Protocol
UML4DDS
ISO-C++ PSM 2010
Java5 PSM 2010 2004
2008
X-T
ype
s 20
10
DDS
App
UML4DDS
2004
2008
X-T
ype
s 20
10
We
b-D
DS
2011
We
b-D
DS
2011
§ Remote Method Invocations over DDS
§ Synchronous, Asynchronous and one ways RMI
Sec
urity
20
12
Sec
urity
20
12
DDS-RMI 2012
DDS-RMI 2012
2011 2011
Mapping JMS to DDS
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWriter Topic
Subscriber
DataReader
DDS JMS
Session
Pub/Sub
Connection
Session
Producer Destination Consumer
Establishes connection with the Broker
Gives access to a DDS Domain
Connection
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWriter Topic
Subscriber
DataReader
DDS JMS
Pub/Sub
Connection
Session
Producer Destination Consumer Establishes a JMS Session
Manage publishers and subscribers sessions
Session
Connection
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWriter Topic
Subscriber
DataReader
DDS JMS
Reader/Writer for application defined Topic Types
Connection
Session
Producer Destination Consumer
Messaging Abstractions. A Destination can be a Topic or a Queue
Session
Connection
Pub/Sub
Pub/Sub & Topics
Note: Topics are the kind of JMS Destination associated with the Pub/Sub Domain
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
JMS Topics ¨ A Topic defines the subject of
publications and subscriptions
¨ The topic name has a weakly defined semantics w.r.t. the subscription matching
¨ Topics are Administered Objects and should preferably be defined outside the application. API for local definition also exist
“com.myco.VPos”
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Topics ¨ A Topic defines the subject of
publications and subscriptions
¨ A Topic has associated a user defined extensible type and QoS
¨ The Topic name, type and QoS have a well defined role in matching subscriptions
¨ Topics can be discovered or locally defined
“com.myco.VPos”
DURABILITY, DEADLINE, PRIORITY, …
[1/2]
struct VehiclePosition{ ! string plate; @Key ! long x; ! longy; !} !
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS Topics
¨ DDS Topic types can have associated keys
¨ Each unique key-value identify a Topic Instance – a specific stream of values
[2/2] “com.myco.VPos”
DURABILITY, DEADLINE, PRIORITY, …
struct VehiclePosition{ ! string plate; @Key ! long x; ! longy; !} !
Plugging into JMS/DDS
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWrter
Topic Subscriber
DataReader
Connection
Session
Producer Topic Consumer
JMS
Session
Reader/Writers User Defined for Types
Pub/Sub
Establishes connection with the Broker
// Get connectionFactory from JNDI !Connection c = ! connectionFactory.createConnection(); !
Connection
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Connection
Session
Producer Topic Consumer
JMS
Reader/Writers User Defined for Types
Pub/Sub Establishes a JMS Session
// Get connectionFactory from JNDI !Connection c = ! connectionFactory.createConnection(); !
Session s = ! c.createSession(false, ! Session.AUTO_ACKNOWLDEGE); !
Session
Connection
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Connection
Session
Producer Destination Consumer
JMS
Reader/Writers User Defined for Types
Messaging Abstractions. A Destination can be a Topic or a Queue
// Get connectionFactory from JNDI !Connection c = ! connectionFactory.createConnection(); !
Session s = ! c.createSession(false, ! Session.AUTO_ACKNOWLDEGE); !
// Look-up destination from JNDI!Destination d = ! (Destination )jndi.lookup(destName); !!// Create a Producer!MessageProducer mp = s.createProducer(d); !!// Create a Consumer!MessageConsumer mc = s.createConsumer(d); !
Session
Connection
Pub/Sub
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWriter Topic
Subscriber
DataReader
DDS
Session
Pub/Sub
Gives access to a DDS Domain
Connection
DomainParticipant dp = ! theDomainParticipantFactory().create_participant(0); !
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWriter Topic
Subscriber
DataReader
DDS
Pub/Sub Manage publishers and subscribers sessions
Session
Connection
DomainParticipant dp = ! theDomainParticipantFactory().create_participant(0); !
// Create a Publisher / Subscriber!Publisher p = dp.create_publisher(); !Subscriber s = dp.create_subscriber(); !// Create a Topic!Topic<Foo> t = dp.create_topic<Foo>(name) !
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Domain Participant
Publisher
DataWriter Topic
Subscriber
DataReader
DDS
Session
Connection
Pub/Sub
Reader/Writer for application defined Topic Types
DomainParticipant dp = ! theDomainParticipantFactory().create_participant(0); !
// Create a Publisher / Subscriber!Publisher p = dp.create_publisher(); !Subscriber s = dp.create_subscriber(); !// Create a Topic!Topic<Foo> t = dp.create_topic<Foo>(name) !
// Create a DataWriter/DataWriter!DataWriter<Foo> dw = pub.create_datawriter(t); !DataReader<Foo> dr = sub.create_datareader(t); !
Messages & Data
¨ JMS allows to distribute Messages
¨ DDS allows to share Data
¨ Both DDS and JMS provide a Topic-Based Pub/Sub abstraction to match interests
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Message
Body
Properties Header
JMS Message
¨ JMS Messages are composed by ¨ Header – Used for routing
¨ Property – Filtering, etc.
¨ Body – Data
¨ 5 Different Body types are supported
Body Stream
Map
Text
Object
Byte
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Topic Types ¨ Topic types can be defined
in IDL, UML, XML, Java
¨ Topics types are extensible and evolvable
¨ Rich set of annotations to deal with fields that might be optional, shared, etc.
¨ Each unique key value identifies a Topic Instance
¨ Topic Instance, can be Created, Read, Updated, and Disposed (CRUD)
struct VehiclePosition{ ! string plate; //@Key ! long x; ! long y; !} !
VehiclePositionVehiclePositionVehiclePosition
plate
“A123”
“B456”
“C789”
x y
101 202
303 202
101 606
TrakCo.VehiclePositionTopic
Topic Type
Topic Instances
Topic Key
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
In Summary
DDS
¨ Topics have associated user defined Types
¨ These user defined types are used to read/write topic instances
JMS
¨ Topics represent a kind of Destination for Messages
¨ User-Types have to be mapped into one of the 5 message bodies defined by JMS
Sending/Receiving Messages
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Sending Message
¨ JMS provides 5 message body types
¨ Messages are sent through the Producer
// Create a Text Message!TextMessage tm = s.createTextMessage(“Hello”); !// Send the Text Message!mp.send(tm); !!
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Sending Message
¨ JMS provides 5 message body types
¨ Messages are sent through the Producer
!VehiclePosition vp = ! new VehiclePosition(“Hello”, 10, 20); !!// Create an Object Message!ObjectMessage om = s.createObjectMessage(vp); !// Send the Object Message!mp.send(om); !!
class VehiclePosition ! implements java.io.Serializable { ! private String plate;! private long x; ! private long y; !! // Ctors / Setters / Getters!} !
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Receiving Messages ¨ JMS Application receive
generic Message and have to understand what the type is (usually via down-casts)
¨ Messages can be read proactively or listener can be registered
¨ Messages are retrieved one at the time
// Receive Message…!TextMessage tm = (TextMessage)ms.receive(); !String str = tm.getText(); !!
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Receiving Messages ¨ JMS Application receive
generic Message and have to understand what the type is (usually via down-casts)
¨ Messages can be read proactively or listener can be registered
¨ Messages are retrieved one at the time
!ObjectMessage om = (ObjectMessage)ms.receive(); !VehiclePosition vp = (VehiclePosition)om.getObject(); !!// Notice that any of the casts above could fail !// at runtime… !
Reading/Writing "Data
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Writing Data ¨ DDS allows
applications to define their own data types and associate them with Topics
¨ Topic updates are written through the DataWriter
VehiclePosition vp(“Hello”, 10, 20); !dw << vp; !!// Alternative Syntax !dw.write(vp); !!!
class VehiclePosition { !public: ! const std::string& plate() const; ! void plate(const std::string& s); ! int32_t x() const; ! void x(int32_t i); ! int32_t y() const; ! void y(int32_t i); !// Encapsulated State Representation!}; !
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Reading Data ¨ DDS provide a strongly
typed API for reading data that relies on DataReaders
¨ Messages can be read proactively or listener can be registered
¨ DDS provides A very flexible selection mechanism for topic samples
// Read Data !!std::vector<VehiclePosition> data(size); !std::vector<SampleInfo> info(size); !!dr.read(data.begin(), info.begin(), size);!
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
DDS vs. JMS ¨ DDS provides an end-to-
end type-safe abstraction for distributing publications of user defined topic types
¨ JMS requires user to “guess types” this introduce potential for runtime errors
// Read Data !!std::vector<VehiclePosition> data(size); !std::vector<SampleInfo> info(size); !!dr.read(data.begin(), info.begin(), size);!
// Receive Message…!TextMessage tm = (TextMessage)ms.receive(); !String str = tm.getText(); !!// =============================================!!ObjectMessage om = (ObjectMessage)ms.receive(); !VehiclePosition vp = (VehiclePosition)om.getObject(); !!// Notice that any of the casts above could fail !// at runtime… !
DDS. What Else?
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Instance/History Management ¨ An Instance per unique key value
¨ An update for a Topic Instance is called Sample
¨ DDS can maintain a configurable history of samples per Topic Instance
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Topic Instances vs. Messages
com.myco.VPos
com.myco.VPos
DDS
JMS
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Topic Instances vs. Messages
com.myco.VPos
com.myco.VPos
DDS
JMS
“A01” 100 200
“A01” 100 200
New
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Topic Instances vs. Messages
“A01” 100 200
“B41” 57 31
com.myco.VPos
“A01” 100 200 “B41” 57 31
com.myco.VPos
DDS
JMS
New
New
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
“A01” 100 200 “B41” 57 31
com.myco.VPos
“A01” 110 210
Topic Instances vs. Messages
“A01” 100 200
“B41” 57 31
com.myco.VPos
DDS
JMS
“A01” 110 210 New
New
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
“A01” 100 200 “B41” 57 31
com.myco.VPos
“A01” 110 210
Topic Instances vs. Messages
“A01” 100 200
“B41” 57 31
com.myco.VPos
DDS
JMS
“A01” 110 210 “A01” 120 220
“A01” 120 220
New
New
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
“A01” 100 200 “B41” 57 31
com.myco.VPos
“A01” 110 210
Topic Instances vs. Messages
“A01” 100 200
“B41” 57 31
com.myco.VPos
DDS
JMS
“A01” 110 210 “A01” 120 220
“A01” 120 220
“B41” 47 19
“B41” 47 19
New
New
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
“A01” 100 200 “B41” 57 31
com.myco.VPos
“A01” 110 210
Topic Instances vs. Messages
“A01” 100 200
“B41” 57 31
com.myco.VPos
DDS
JMS
“A01” 110 210 “A01” 120 220
“A01” 120 220
“B41” 47 19
“B41” 47 19
New
New “B41” - - Disposed
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Dynamic Discovery
¨ DDS dynamically discovers publishers, subscribers as well as Topics
¨ Dynamic Discovery has a key role in subscriptions matching
¨ No global configuration is required
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
QoS Framework ¨ DDS provides a
mechanism for end-to-end QoS matching
¨ Communication is established iff the QoS offered by the publisher matches/exceeds that requested by the subscriber
Publisher
DataWriter
Topic
Type
QoS
Name
writes
QoS
DataWriter
Topic
Typewrites
Subscriber
DataReaderreads
DataReaderreads
...
QoS
Name
QoS
QoS QoS
QoS matching
......
QoS QoS
Type Matching
DomainParticipant DomainParticipant
QoS QoS
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
QoS Policies QoS Policy Applicability RxO Modifiable
DURABILITY
DURABILITY SERVICE
LIFESPAN
HISTORY
PRESENTATION
RELIABILITY
PARTITION
DESTINATION ORDER
OWNERSHIP
OWNERSHIP STRENGTH
DEADLINE
LATENCY BUDGET
TRANSPORT PRIORITY
T, DR, DW Y N
Data Availability
T, DW N NData Availability
T, DW N/A Y
Data Availability
T, DR, DW N N
Data Availability
P, S Y N
Data Delivery
T, DR, DW Y N
Data Delivery
P, S N YData DeliveryT, DR, DW Y NData Delivery
T, DR, DW Y N
Data Delivery
DW N/A Y
Data Delivery
T, DR, DW Y Y
Data Timeliness
T, DR, DW Y YData Timeliness
T, DW N/A Y
Data Timeliness
TIME BASED FILTER
RESOURCE LIMITS
ENTITY FACTORY
USER DATA
TOPIC DATA
GROUP DATA
LIVELINESS
WRITER DATA LIFECYCLE
READER DATA LIFECYCLE
DR N/A Y
ResourcesT, DR, DW N N
Resources
ConfigurationDP, DR, DW N Y
ConfigurationT N Y Configuration
P, S N Y
Configuration
T, DR, DW Y N
Configuration
DW N/A Y
LifecycleDR N/A Y
Lifecycle
QoS Policy Applicability RxO Modifiable
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Content Awareness ¨ DDS make it possible
express filters and queries on the whole content of a topic type
¨ Filters can be used to establish content filtered subscriptions
¨ Queries can be used to create local views of available data
struct VehiclePosition{ ! string plate; @Key ! long x; ! long y; !} !
Filter Examples: “x < %0 AND y < %1” “y BETWEEN (10 AND 20)”
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
High Performance
¨ OpenSplice DDS is 2.5x-3x faster than high performance JMS implementations
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
High Performance
Size (bytes)
Lat
en
cy (
use
c)
¨ OpenSplice DDS delivers very low and predictable latencies
¨ No other Pub/Sub technology can approach similar level of performance!
JMS Legacy?
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Integrating JMS with DDS ¨ Existing JMS systems can be
easily integrated with DDS today using Apache Camel
¨ High Performance, High Availability Integration of DDS with JMS will also available through the Blend-Box (available later this year)
BLEND-Box
ULS D
DSI
DDSI JMS
WS-*
REST
CustomOpenSplice DDS
Web Connectors compliant withthe Web-Enabled DDS Specificaiton
DDS Connectors
OpenSplice DDS Connector
Custom Connectors
DDS in Action
Summing Up
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
Concluding Remarks ¨ DDS is a powerful lively standard for publish/
subscribe
¨ DDS provides some very useful abstractions not available in JMS, such as user-defined types, instances, history, etc.
¨ DDS can be as simple to use as JMS, but when required provides far more knobs for tuning scalability, performance and QoS
Copyrig
ht 2010, PrismTech – A
ll Rights Reserved.
http://www.opensplice.com/
http://www.opensplice.org/
emailto:[email protected]
http://www.youtube.com/OpenSpliceTube http://opensplice.blogspot.com
http://bit.ly/1Sreg
http://www.slideshare.net/angelo.corsaro
http://twitter.com/acorsaro/
D e l i v e r i n g P e r f o r m a n c e , O p e n n e s s , a n d F r e e d o m
OpenSplice DDS