SlideShare una empresa de Scribd logo
1 de 47
Descargar para leer sin conexión
OpenSpliceDDS
Angelo CORSARO, Ph.D.
Chief Technology Officer
OMG DDS Sig Co-Chair
PrismTech
angelo.corsaro@prismtech.com
DDS + Android =
OpenSplice |Mobile
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
What I’ll Cover Today
☐ Learn about OpenSplice Mobile
☐ Understand OpenSplice Mobile Architecture and
Performance
☐ Get started with DDS programming on Android
OpenSpliceDDS
Introducing OpenSplice Mobile
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
DDS Everywhere Platform
☐ A DDS-based, interoperable
product family addressing
systems needs from Embedded
and Mobile to Enterprise and
Cloud
☐ An Open Source core providing
free access to the OpenSplice
Ecosystem, security of supply and
a vibrant, innovative community
OpenSplice
Community
OpenSplice
Cloud
OpenSplice
Embedded
OpenSplice
OpenSplice
Enterprise
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Key Highlights
☐ Brings DDS on mobile
devices powered by
Android/iOS
☐ Enables DDS-based
Cloud Messaging for
higher scalability,
throughout and minimal
cost per message
OpenSplice
Community
OpenSplice
Cloud
OpenSplice
Embedded
OpenSplice
OpenSplice
Enterprise
OpenSplice
Mobile
OpenSplice
Gateway
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
OpenSplice Mobile
☐ Pure Java version of
OpenSplice targeting the JVM
☐ DDSI Protocol Stack optimized
for mobility and Android OS
☐ Only DDS on the market
designed and Engineered for
Android and the JVM
DCPS Java 5 / Scala API
DDSI
(Optimized for Mobility)
OpenSplice Mobile brings Peer-2-Peer, infrastructure-less communication
to the Android platform
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
OpenSplice Mobile
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
In Action...
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
DDS Compliance
DDS Profiles
☐ Minimum
☐ Ownership
☐ Durability (only Transient Local)
API
☐ Java 5 DDS PSM (i.e. latest Java 5 API for DDS)
DDSI
☐ Full implementation of DDSI v2.1 with support for large data (i.e.
fragmentation)
☐ Interoperability demonstrated with other vendors at the DDS Info Day
in March 2013
OpenSpliceDDS
OpenSplice Mobile
Architecture
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
A Staged Event Driven Architecture
☐ OpenSplice Mobile has a Staged Event Driven Architecture (SEDA)
that allows it to be easily configured to trade off between
throughput and latency
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
SEDA
☐ Aims at decomposing a complex, event-driven application into a set of stages
connected by queues
☐ Avoids the high overhead associated with thread-based concurrency models,
and decouples event and thread scheduling from application logic.
☐ Through admission control on each event queue, SEDAs can be well-conditioned
to load, preventing resources from being overcommitted when demand
exceeds service capacity
[Matt Welsh, David Culler, and Eric Brewer, SEDA:An Architecture for Well-Conditioned, Scalable Internet Services]
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
OpenSplice Mobile Architecture
The OpenSplice Mobile architecture is
organize around three stages
☐ Packet Processing
☐ Message Processing
☐ Data Processing
The channel that connect each stage
can be configured to be active or passive
Packet
Processor
Message
Processor
Data
Processor
Network Packet
DDSI Messages
Cache Changes
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Configurability
☐ Channels can be active or passive (and zero-
copy). That means that channels can be
configured with threading resources, or not
☐ Messages posted in a passive channel are
executed in the context of the posting thread
☐ This allows to configure OpenSplice Mobile to
optimize the use case at hand
Processor
Channel
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Sample Configurations
Single Thread per Message
Packet
Processor
Message
Processor
Data
Processor
Network Packet
DDSI Messages
Cache Changes
Fully Asynchronous
Packet
Processor
Message
Processor
Data
Processor
Network Packet
DDSI Messages
Cache Changes
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Configuration in Practice
☐ OpenSplice Mobile is SEDA architecture as well as all the protocol
parameters can be configured through configuration file or via
command line properties , i.e. providing -D options to the JVM
☐ Configuration parameters are listed on the user manual
☐ Example:
java	
  -­‐server	
  	
  -­‐cp	
  .:./target/jmobile-­‐demo-­‐assembly-­‐2.0.jar	
  	
  
-­‐Ddds.listeners.useTransportThread=true	
  
-­‐Dddsi.writers.heartbeatPeriod=0.001	
  	
  
-­‐Dddsi.writers.nackResponseDelay=0	
  	
  
-­‐Dddsi.readers.heartbeatResponseDelay=0	
  
-­‐Dddsi.timer.threadPool.size=1	
  	
  
-­‐Dddsi.receiver.threadPool.size=0	
  	
  
-­‐Dddsi.dataProcessor.threadPool.size=0	
  
-­‐Dddsi.acknackProcessor.threadPool.size=0	
  
-­‐Dddsi.writers.reliabilityQueue.size=128	
  	
  
org.opensplice.jmobile.demo.perf.RoundTripDemoReader	
  $*
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Performance
☐ OpenSplice Mobile v1.0
beta features already
very good performance
☐ Latency is low and pretty
stable ~3usec of
difference from 32 to 1024
bytes
OpenSpliceDDS
Android and OpenSplice
Mobile
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Android Fundamentals
☐ Android applications are written in the Java programming
language
☐ Support for native code is available, but this often leads to worse
performance (due to the JNI layer) and worse battery utilization
☐ Thus unless you have very good reasons not to, you are strongly
encouraged to write android applications in Java and to leverage
on Java libraries!
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Android Application in a Nutshell
☐ An Android application runs in its own JVM and (by default) on its own
linux process
☐ An application may be composed of the following elements:
☐ Activities: a single screen with a user interface
☐ Services: a component that runs in the background to perform long-running
operations or to perform work for remote processes.
☐ Content Providers: a component that manages shared data for a set of
applications
☐ Broadcast Receivers: a component that responds to system-wide broadcast
announcements
☐ Android allows any applications to start any other application
component and potentially consume the data it produces
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Component Activation
☐ Activities, Services and Broadcast Receivers are activated through
an asynchronous message, called Intent
☐ For Activities and Services the intent specifies the action to perform
☐ For Broadcast Receivers it specifies the event being broadcasted,
e.g. battery-low
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Application Manifest
☐ The manifest is an XML file containing several important information
about the application
☐ Among, other things, the manifest includes the authorization
necessary for your application -- for instance, it is in this file that you
have to mention that your application requires access to the
network, etc.
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Activities Lifecycle
☐ Notice that Activities are also
destroyed each time there is a
screen rotation (unless you
don’t explicitly manage it)
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Tasks and Back-Stack
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
DDS-based and Android Apps
Considering the Android application lifecycle, we should ask
ourselves a few questions:
☐ When should we create DDS entities and who should hold a
reference to them?
☐ What happens when an application is no more visible?
☐ Can I control when my application exits?
☐ How do I deal with multi-threading?
OpenSpliceDDS
DDS Chat
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
DDS Chat for Android
☐ To learn how to write an
Android Application that
uses OpenSplice Mobile
we’ll develop a very
simple Chat
☐ To keep things simple this
chat will have a single
“chat room”
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Step 1: Architecture
☐ Our Chat application will have a very simple architecture with a
single just a single Activity that will take care of:
☐ Posting Chat Messages into the ChatRoom
☐ Displaying the Chat Messages Posted in the room since when we joined
☐ In terms of information modeling, we’ll have a single topic
representing the user post
struct ChatMessage {
string user;
string msg;
};
#pragma keylist ChatMessage user
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Step 2: Lifecycle Management
☐ Creating DDS entities, such as
DomainParticipants, DataReaders
and DataWriters involves network
communication, such as discovery
information
☐ In addition when an a DDS entity is
destroyed it looses its state
☐ As such, tying the life-cycle of DDS
entities to activities should be done
with great care
[1/2]
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Step 2: Lifecycle Management
☐ In general, it is a better idea to tie the
life-cycle of DDS entities to the
Application as opposed to Activities
☐ In some cases, it may make sense to
tie the life-cycle of DataReaders/
DataWriters to that of the activity
that relies on them -- Usually this
makes sense for activities that are
“one-off”
[2/2]
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Application
public class ChatApplication extends Application {
DataReader<ChatMessage> dr;
DataWriter <ChatMessage> dw;
DomainParticipant dp;
@Override
public void onCreate() {
super.onCreate();
// This should be defined via a resource -- but for a small
// demo that’s OK.
System.setProperty(ServiceEnvironment.IMPLEMENTATION_CLASS_NAME_PROPERTY,
"org.opensplice.mobile.core.ServiceEnvironmentImpl");
ServiceEnvironment env = ServiceEnvironment.createInstance(
ChatApplication.class.getClassLoader());
DomainParticipantFactory dpf =
DomainParticipantFactory.getInstance(env);
dp = dpf.createParticipant(0);
Topic<ChatMessage> topic = dp.createTopic("TChatMessage",ChatMessage.class);
Publisher pub = dp.createPublisher();
Subscriber sub = dp.createSubscriber();
dw = pub.createDataWriter(topic);
dr = sub.createDataReader(topic);
}
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Application
public DataReader<ChatMessage> reader() {
return this.dr;
}
public DataWriter<ChatMessage> writer() {
return this.dw;
}
@Override
public void onTerminate() {
super.onTerminate();
this.dp.close();
}
}
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Manifest...
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:name="ChatApplication" >
<activity
android:name="org.opensplice.mobile.ddschat.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
More Manifest...
☐ When using OpenSplice Mobile you need to grant the proper
permissions for networking:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Activity GUI
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView android:id="@+id/chatMessages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/chat_msgs"
android:visibility="gone"
android:background="#666"
android:textColor="#fff"
android:paddingLeft="5dp"
/>
<ListView
android:id="@+id/messageList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Activity GUI
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="sendChatMessage"
android:text="@string/button_send" />
</LinearLayout>
</LinearLayout>
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Activity
1
2 public class MainActivity extends Activity {
3
4 private static final String TAG = "ChatMainActivity";
5 private final Handler handler = new Handler();
6 private ArrayAdapter<String> chatMessages;
7
8 public class ChatMessageListener extends ChatMessageDataListener {
9 // ...
10 }
11
12 @Override
13 protected void onCreate(Bundle savedInstanceState) {
14 super.onCreate(savedInstanceState);
15 setContentView(R.layout.activity_main);
16 chatMessages = new ArrayAdapter<String>(this, R.layout.messages);
17 chatMessages.add("Welcome to the DDS Chat Room");
18 ListView mview = (ListView) findViewById(R.id.messageList);
19 mview.setAdapter(chatMessages);
20 ChatApplication app = (ChatApplication) getApplication();
21
22 app.reader().setListener(new ChatMessageListener());
23
24 }
25
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Activity
25
26 @Override
27 public boolean onCreateOptionsMenu(Menu menu) {
28 // Inflate the menu; this adds items to the action bar if it is present.
29 getMenuInflater().inflate(R.menu.main, menu);
30 return true;
31 }
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Activity
32
33 public void sendChatMessage(View view) {
34 EditText editText = (EditText) findViewById(R.id.message);
35 String msg = editText.getText().toString();
36 editText.setText("");
37 // chatMessages.add(msg);
38 ChatApplication app = (ChatApplication) getApplication();
39 try {
40 Log.i(TAG, ">>> Sending data " + msg);
41 app.writer().write(new ChatMessage(usr, msg));
42 } catch (TimeoutException te) {
43 }
44 }
45
46 }
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Receiving Data
☐ Receiving data is a bit trickier since in Android only the thread that
runs an activity has the right to change the UI
☐ This means, that from a DDS listener it is not possible to change an
the UI directly!
☐ The solution in to use an Android Handler	
  to which we can post
Runnable to be executed by the activity thread
☐ Let’s see how this works
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
DDS Listener & Android Handler
1 public class ChatMessageListener extends ChatMessageDataListener {
2
3 private DataReader<ChatMessage> dr;
4
5 public ChatMessageListener() {
6 ChatApplication app = (ChatApplication) getApplication();
7 dr = app.reader();
8 }
9
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
DDS Listener & Android Handler
10 @Override
11 public void onDataAvailable(DataAvailableEvent<ChatMessage> dae) {
12 final Iterator<ChatMessage> i = dr.read();
13
14 Log.i(TAG, ">>> DataReaderListener.onDataAvailable");
15 if (i.hasNext()) {
16 Runnable dispatcher = new Runnable() {
17 public void run() {
18 while (i.hasNext()) {
19 Sample<ChatMessage> s = i.next();
20
21 if (s.getSampleState() == SampleState.NOT_READ) {
22 ChatMessage cm = s.getData();
23 chatMessages.add(cm.user + " > " + cm.msg);
24 }
25 }
26 }
27 };
28 handler.post(dispatcher);
29 }
30 }
31 }
OpenSpliceDDS
Putting all Together
OpenSpliceDDS
Final Remarks
Copyright	
  2011,	
  PrismTech	
  –	
  	
  All	
  Rights	
  Reserved.
OpenSpliceDDS
Concluding Remarks
☐ OpenSplice Mobile is the only pure Java DDS implementation
available on the market. This means that it is the best choice for
Java-Based DDS applications as well as Android Applications
☐ Its performance are very close to native C/C++ DDS
implementations
☐ OpenSplice Mobile architecture is very flexible and can be easily
configured to deliver extremely low latency as well as extremely
high throughput
OpenSpliceDDS
OpenSpliceDDS
¥@prismtech
¥@acorsaro
¥youtube.com/opensplicetube ¥slideshare.net/angelo.corsaro
¥ crc@prismtech.com
¥sales@prismtech.com
¥opensplice.com ¥forums.opensplice.org
¥opensplice.org ¥opensplicedds@prismtech.com
:: Connect with Us ::

Más contenido relacionado

La actualidad más candente

Introduction to OMG DDS (1 hour, 45 slides)
Introduction to OMG DDS (1 hour, 45 slides)Introduction to OMG DDS (1 hour, 45 slides)
Introduction to OMG DDS (1 hour, 45 slides)
Gerardo Pardo-Castellote
 

La actualidad más candente (20)

OMG DDS: The Data Distribution Service for Real-Time Systems
OMG DDS: The Data Distribution Service for Real-Time SystemsOMG DDS: The Data Distribution Service for Real-Time Systems
OMG DDS: The Data Distribution Service for Real-Time Systems
 
RTI Data-Distribution Service (DDS) Master Class 2011
RTI Data-Distribution Service (DDS) Master Class 2011RTI Data-Distribution Service (DDS) Master Class 2011
RTI Data-Distribution Service (DDS) Master Class 2011
 
Data Sharing in Extremely Resource Constrained Envionrments
Data Sharing in Extremely Resource Constrained EnvionrmentsData Sharing in Extremely Resource Constrained Envionrments
Data Sharing in Extremely Resource Constrained Envionrments
 
Distributed Algorithms with DDS
Distributed Algorithms with DDSDistributed Algorithms with DDS
Distributed Algorithms with DDS
 
The Present and Future of DDS
The Present and Future of DDSThe Present and Future of DDS
The Present and Future of DDS
 
Cyclone DDS: Sharing Data in the IoT Age
Cyclone DDS: Sharing Data in the IoT AgeCyclone DDS: Sharing Data in the IoT Age
Cyclone DDS: Sharing Data in the IoT Age
 
Introduction to OMG DDS (1 hour, 45 slides)
Introduction to OMG DDS (1 hour, 45 slides)Introduction to OMG DDS (1 hour, 45 slides)
Introduction to OMG DDS (1 hour, 45 slides)
 
OMG Data-Distribution Service (DDS) Tutorial - 2009
OMG Data-Distribution Service (DDS) Tutorial - 2009OMG Data-Distribution Service (DDS) Tutorial - 2009
OMG Data-Distribution Service (DDS) Tutorial - 2009
 
Distributed Simulations with DDS and HLA
Distributed Simulations with DDS and HLADistributed Simulations with DDS and HLA
Distributed Simulations with DDS and HLA
 
What Can DDS Do For You?
What Can DDS Do For You?What Can DDS Do For You?
What Can DDS Do For You?
 
Why is Core DX the Best DDS?
Why is Core DX the Best DDS?Why is Core DX the Best DDS?
Why is Core DX the Best DDS?
 
UML Profile for DDS
UML Profile for DDSUML Profile for DDS
UML Profile for DDS
 
The Data Distribution Service Tutorial
The Data Distribution Service TutorialThe Data Distribution Service Tutorial
The Data Distribution Service Tutorial
 
zenoh -- the ZEro Network OverHead protocol
zenoh -- the ZEro Network OverHead protocolzenoh -- the ZEro Network OverHead protocol
zenoh -- the ZEro Network OverHead protocol
 
The DDS Tutorial Part II
The DDS Tutorial Part IIThe DDS Tutorial Part II
The DDS Tutorial Part II
 
DDS Tutorial -- Part I
DDS Tutorial -- Part IDDS Tutorial -- Part I
DDS Tutorial -- Part I
 
Vortex II -- The Industrial IoT Connectivity Standard
Vortex II -- The  Industrial IoT  Connectivity StandardVortex II -- The  Industrial IoT  Connectivity Standard
Vortex II -- The Industrial IoT Connectivity Standard
 
Introducing Vortex Lite
Introducing Vortex LiteIntroducing Vortex Lite
Introducing Vortex Lite
 
Vortex Tutorial -- Part I
Vortex Tutorial -- Part IVortex Tutorial -- Part I
Vortex Tutorial -- Part I
 
zenoh -- the ZEro Network OverHead protocol
zenoh -- the ZEro Network OverHead protocolzenoh -- the ZEro Network OverHead protocol
zenoh -- the ZEro Network OverHead protocol
 

Destacado

Ralph credsdeck 12
Ralph credsdeck 12Ralph credsdeck 12
Ralph credsdeck 12
Jay Armitage
 
In Memoriam Octavian Paler
In Memoriam Octavian PalerIn Memoriam Octavian Paler
In Memoriam Octavian Paler
puicarmariana
 
Europe 6A
Europe 6AEurope 6A
Europe 6A
C FM
 
Africa 6A
Africa 6AAfrica 6A
Africa 6A
C FM
 
Anti Aging 5 Point Ppt Nov2008
Anti Aging 5 Point Ppt Nov2008Anti Aging 5 Point Ppt Nov2008
Anti Aging 5 Point Ppt Nov2008
amysutton
 
Investment decisions for pension funds by intangible value capital
Investment decisions for pension funds by intangible value capitalInvestment decisions for pension funds by intangible value capital
Investment decisions for pension funds by intangible value capital
JAYARAMAN IYER
 

Destacado (20)

10 Reasons for Choosing OpenSplice DDS
10 Reasons for Choosing OpenSplice DDS10 Reasons for Choosing OpenSplice DDS
10 Reasons for Choosing OpenSplice DDS
 
How to Design Distributed Robotic Control Systems
How to Design Distributed Robotic Control SystemsHow to Design Distributed Robotic Control Systems
How to Design Distributed Robotic Control Systems
 
ikd312-09-normalisasi
ikd312-09-normalisasiikd312-09-normalisasi
ikd312-09-normalisasi
 
IKD312-01-pendahuluan
IKD312-01-pendahuluanIKD312-01-pendahuluan
IKD312-01-pendahuluan
 
Option 2 - Coast
Option 2 - CoastOption 2 - Coast
Option 2 - Coast
 
Ralph credsdeck 12
Ralph credsdeck 12Ralph credsdeck 12
Ralph credsdeck 12
 
In Memoriam Octavian Paler
In Memoriam Octavian PalerIn Memoriam Octavian Paler
In Memoriam Octavian Paler
 
Sql Server Optimizer Screenshots
Sql Server Optimizer ScreenshotsSql Server Optimizer Screenshots
Sql Server Optimizer Screenshots
 
Mcm ottobre 11
Mcm ottobre 11Mcm ottobre 11
Mcm ottobre 11
 
Worshop
WorshopWorshop
Worshop
 
Kamloops Gr 2.3.Reading.Oct 2014
Kamloops Gr 2.3.Reading.Oct 2014Kamloops Gr 2.3.Reading.Oct 2014
Kamloops Gr 2.3.Reading.Oct 2014
 
Europe 6A
Europe 6AEurope 6A
Europe 6A
 
Black friday haine
Black friday haineBlack friday haine
Black friday haine
 
BJF.Delta.Nov Redesigned ELA Curriculum K-3
BJF.Delta.Nov Redesigned ELA Curriculum K-3BJF.Delta.Nov Redesigned ELA Curriculum K-3
BJF.Delta.Nov Redesigned ELA Curriculum K-3
 
API Design
API DesignAPI Design
API Design
 
Africa 6A
Africa 6AAfrica 6A
Africa 6A
 
Living in a Post-Morrison World
Living in a Post-Morrison WorldLiving in a Post-Morrison World
Living in a Post-Morrison World
 
Anti Aging 5 Point Ppt Nov2008
Anti Aging 5 Point Ppt Nov2008Anti Aging 5 Point Ppt Nov2008
Anti Aging 5 Point Ppt Nov2008
 
Investment decisions for pension funds by intangible value capital
Investment decisions for pension funds by intangible value capitalInvestment decisions for pension funds by intangible value capital
Investment decisions for pension funds by intangible value capital
 
Funniest Slideshow ever
Funniest Slideshow everFunniest Slideshow ever
Funniest Slideshow ever
 

Similar a DDS + Android = OpenSplice Mobile

Multi-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud ComputingMulti-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud Computing
Srinath Perera
 
cloud computing and android
cloud computing and androidcloud computing and android
cloud computing and android
Mohit Singh
 

Similar a DDS + Android = OpenSplice Mobile (20)

Desktop, Embedded and Mobile Apps with PrismTech Vortex Cafe
Desktop, Embedded and Mobile Apps with PrismTech Vortex CafeDesktop, Embedded and Mobile Apps with PrismTech Vortex Cafe
Desktop, Embedded and Mobile Apps with PrismTech Vortex Cafe
 
Desktop, Embedded and Mobile Apps with Vortex Café
Desktop, Embedded and Mobile Apps with Vortex CaféDesktop, Embedded and Mobile Apps with Vortex Café
Desktop, Embedded and Mobile Apps with Vortex Café
 
DDS Made Simple
DDS Made SimpleDDS Made Simple
DDS Made Simple
 
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
DDS Advanced Tutorial - OMG June 2013 Berlin MeetingDDS Advanced Tutorial - OMG June 2013 Berlin Meeting
DDS Advanced Tutorial - OMG June 2013 Berlin Meeting
 
DDS on the Web: Quick Recipes for Real-Time Web Applications
DDS on the Web: Quick Recipes for Real-Time Web ApplicationsDDS on the Web: Quick Recipes for Real-Time Web Applications
DDS on the Web: Quick Recipes for Real-Time Web Applications
 
CLOUD COMPUTING: A REVIEW
CLOUD COMPUTING: A REVIEWCLOUD COMPUTING: A REVIEW
CLOUD COMPUTING: A REVIEW
 
Multi-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud ComputingMulti-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud Computing
 
All-inclusive insights on Building JavaScript microservices with Node!.pdf
All-inclusive insights on Building JavaScript microservices with Node!.pdfAll-inclusive insights on Building JavaScript microservices with Node!.pdf
All-inclusive insights on Building JavaScript microservices with Node!.pdf
 
Con9024 next generation optimized directory - oracle unified directory - final
Con9024 next generation optimized directory - oracle unified directory - finalCon9024 next generation optimized directory - oracle unified directory - final
Con9024 next generation optimized directory - oracle unified directory - final
 
What is expected from Chief Cloud Officers?
What is expected from Chief Cloud Officers?What is expected from Chief Cloud Officers?
What is expected from Chief Cloud Officers?
 
Session
SessionSession
Session
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
OOW13: Next Generation Optimized Directory (CON9024)
OOW13: Next Generation Optimized Directory (CON9024)OOW13: Next Generation Optimized Directory (CON9024)
OOW13: Next Generation Optimized Directory (CON9024)
 
cloud computing and android
cloud computing and androidcloud computing and android
cloud computing and android
 
Software Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectSoftware Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight Project
 
8. 9590 1-pb
8. 9590 1-pb8. 9590 1-pb
8. 9590 1-pb
 
DDS Enabling Open Architecture
DDS Enabling Open ArchitectureDDS Enabling Open Architecture
DDS Enabling Open Architecture
 
Cloud Computing & Cloud Storage
Cloud Computing & Cloud Storage Cloud Computing & Cloud Storage
Cloud Computing & Cloud Storage
 
Institutionalizing Open Source - Puneet Sachdev - Nasscom Tech Series - June ...
Institutionalizing Open Source - Puneet Sachdev - Nasscom Tech Series - June ...Institutionalizing Open Source - Puneet Sachdev - Nasscom Tech Series - June ...
Institutionalizing Open Source - Puneet Sachdev - Nasscom Tech Series - June ...
 
The OpenSplice DDS Revolution -- Episode II
The OpenSplice DDS Revolution -- Episode IIThe OpenSplice DDS Revolution -- Episode II
The OpenSplice DDS Revolution -- Episode II
 

Más de Angelo Corsaro

Más de Angelo Corsaro (20)

Zenoh: The Genesis
Zenoh: The GenesisZenoh: The Genesis
Zenoh: The Genesis
 
zenoh: The Edge Data Fabric
zenoh: The Edge Data Fabriczenoh: The Edge Data Fabric
zenoh: The Edge Data Fabric
 
Zenoh Tutorial
Zenoh TutorialZenoh Tutorial
Zenoh Tutorial
 
Data Decentralisation: Efficiency, Privacy and Fair Monetisation
Data Decentralisation: Efficiency, Privacy and Fair MonetisationData Decentralisation: Efficiency, Privacy and Fair Monetisation
Data Decentralisation: Efficiency, Privacy and Fair Monetisation
 
zenoh: zero overhead pub/sub store/query compute
zenoh: zero overhead pub/sub store/query computezenoh: zero overhead pub/sub store/query compute
zenoh: zero overhead pub/sub store/query compute
 
Breaking the Edge -- A Journey Through Cloud, Edge and Fog Computing
Breaking the Edge -- A Journey Through Cloud, Edge and Fog ComputingBreaking the Edge -- A Journey Through Cloud, Edge and Fog Computing
Breaking the Edge -- A Journey Through Cloud, Edge and Fog Computing
 
Eastern Sicily
Eastern SicilyEastern Sicily
Eastern Sicily
 
fog05: The Fog Computing Infrastructure
fog05: The Fog Computing Infrastructurefog05: The Fog Computing Infrastructure
fog05: The Fog Computing Infrastructure
 
fog05: The Fog Computing Platform
fog05: The Fog Computing Platformfog05: The Fog Computing Platform
fog05: The Fog Computing Platform
 
Programming in Scala - Lecture Four
Programming in Scala - Lecture FourProgramming in Scala - Lecture Four
Programming in Scala - Lecture Four
 
Programming in Scala - Lecture Three
Programming in Scala - Lecture ThreeProgramming in Scala - Lecture Three
Programming in Scala - Lecture Three
 
Programming in Scala - Lecture Two
Programming in Scala - Lecture TwoProgramming in Scala - Lecture Two
Programming in Scala - Lecture Two
 
Programming in Scala - Lecture One
Programming in Scala - Lecture OneProgramming in Scala - Lecture One
Programming in Scala - Lecture One
 
The DDS Security Standard
The DDS Security StandardThe DDS Security Standard
The DDS Security Standard
 
RUSTing -- Partially Ordered Rust Programming Ruminations
RUSTing -- Partially Ordered Rust Programming RuminationsRUSTing -- Partially Ordered Rust Programming Ruminations
RUSTing -- Partially Ordered Rust Programming Ruminations
 
Fog Computing Defined
Fog Computing DefinedFog Computing Defined
Fog Computing Defined
 
DDS In Action Part II
DDS In Action Part IIDDS In Action Part II
DDS In Action Part II
 
DDS in Action -- Part I
DDS in Action -- Part IDDS in Action -- Part I
DDS in Action -- Part I
 
DDS and OPC UA Explained
DDS and OPC UA ExplainedDDS and OPC UA Explained
DDS and OPC UA Explained
 
The Cloudy, Foggy and Misty Internet of Things -- Toward Fluid IoT Architect...
The Cloudy, Foggy and Misty Internet of Things --  Toward Fluid IoT Architect...The Cloudy, Foggy and Misty Internet of Things --  Toward Fluid IoT Architect...
The Cloudy, Foggy and Misty Internet of Things -- Toward Fluid IoT Architect...
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

DDS + Android = OpenSplice Mobile

  • 1. OpenSpliceDDS Angelo CORSARO, Ph.D. Chief Technology Officer OMG DDS Sig Co-Chair PrismTech angelo.corsaro@prismtech.com DDS + Android = OpenSplice |Mobile
  • 2. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS What I’ll Cover Today ☐ Learn about OpenSplice Mobile ☐ Understand OpenSplice Mobile Architecture and Performance ☐ Get started with DDS programming on Android
  • 4. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS DDS Everywhere Platform ☐ A DDS-based, interoperable product family addressing systems needs from Embedded and Mobile to Enterprise and Cloud ☐ An Open Source core providing free access to the OpenSplice Ecosystem, security of supply and a vibrant, innovative community OpenSplice Community OpenSplice Cloud OpenSplice Embedded OpenSplice OpenSplice Enterprise
  • 5. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Key Highlights ☐ Brings DDS on mobile devices powered by Android/iOS ☐ Enables DDS-based Cloud Messaging for higher scalability, throughout and minimal cost per message OpenSplice Community OpenSplice Cloud OpenSplice Embedded OpenSplice OpenSplice Enterprise OpenSplice Mobile OpenSplice Gateway
  • 6. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS OpenSplice Mobile ☐ Pure Java version of OpenSplice targeting the JVM ☐ DDSI Protocol Stack optimized for mobility and Android OS ☐ Only DDS on the market designed and Engineered for Android and the JVM DCPS Java 5 / Scala API DDSI (Optimized for Mobility) OpenSplice Mobile brings Peer-2-Peer, infrastructure-less communication to the Android platform
  • 7. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS OpenSplice Mobile
  • 8. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS In Action...
  • 9. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS DDS Compliance DDS Profiles ☐ Minimum ☐ Ownership ☐ Durability (only Transient Local) API ☐ Java 5 DDS PSM (i.e. latest Java 5 API for DDS) DDSI ☐ Full implementation of DDSI v2.1 with support for large data (i.e. fragmentation) ☐ Interoperability demonstrated with other vendors at the DDS Info Day in March 2013
  • 11. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS A Staged Event Driven Architecture ☐ OpenSplice Mobile has a Staged Event Driven Architecture (SEDA) that allows it to be easily configured to trade off between throughput and latency
  • 12. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS SEDA ☐ Aims at decomposing a complex, event-driven application into a set of stages connected by queues ☐ Avoids the high overhead associated with thread-based concurrency models, and decouples event and thread scheduling from application logic. ☐ Through admission control on each event queue, SEDAs can be well-conditioned to load, preventing resources from being overcommitted when demand exceeds service capacity [Matt Welsh, David Culler, and Eric Brewer, SEDA:An Architecture for Well-Conditioned, Scalable Internet Services]
  • 13. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS OpenSplice Mobile Architecture The OpenSplice Mobile architecture is organize around three stages ☐ Packet Processing ☐ Message Processing ☐ Data Processing The channel that connect each stage can be configured to be active or passive Packet Processor Message Processor Data Processor Network Packet DDSI Messages Cache Changes
  • 14. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Configurability ☐ Channels can be active or passive (and zero- copy). That means that channels can be configured with threading resources, or not ☐ Messages posted in a passive channel are executed in the context of the posting thread ☐ This allows to configure OpenSplice Mobile to optimize the use case at hand Processor Channel
  • 15. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Sample Configurations Single Thread per Message Packet Processor Message Processor Data Processor Network Packet DDSI Messages Cache Changes Fully Asynchronous Packet Processor Message Processor Data Processor Network Packet DDSI Messages Cache Changes
  • 16. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Configuration in Practice ☐ OpenSplice Mobile is SEDA architecture as well as all the protocol parameters can be configured through configuration file or via command line properties , i.e. providing -D options to the JVM ☐ Configuration parameters are listed on the user manual ☐ Example: java  -­‐server    -­‐cp  .:./target/jmobile-­‐demo-­‐assembly-­‐2.0.jar     -­‐Ddds.listeners.useTransportThread=true   -­‐Dddsi.writers.heartbeatPeriod=0.001     -­‐Dddsi.writers.nackResponseDelay=0     -­‐Dddsi.readers.heartbeatResponseDelay=0   -­‐Dddsi.timer.threadPool.size=1     -­‐Dddsi.receiver.threadPool.size=0     -­‐Dddsi.dataProcessor.threadPool.size=0   -­‐Dddsi.acknackProcessor.threadPool.size=0   -­‐Dddsi.writers.reliabilityQueue.size=128     org.opensplice.jmobile.demo.perf.RoundTripDemoReader  $*
  • 17. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Performance ☐ OpenSplice Mobile v1.0 beta features already very good performance ☐ Latency is low and pretty stable ~3usec of difference from 32 to 1024 bytes
  • 19. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Android Fundamentals ☐ Android applications are written in the Java programming language ☐ Support for native code is available, but this often leads to worse performance (due to the JNI layer) and worse battery utilization ☐ Thus unless you have very good reasons not to, you are strongly encouraged to write android applications in Java and to leverage on Java libraries!
  • 20. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Android Application in a Nutshell ☐ An Android application runs in its own JVM and (by default) on its own linux process ☐ An application may be composed of the following elements: ☐ Activities: a single screen with a user interface ☐ Services: a component that runs in the background to perform long-running operations or to perform work for remote processes. ☐ Content Providers: a component that manages shared data for a set of applications ☐ Broadcast Receivers: a component that responds to system-wide broadcast announcements ☐ Android allows any applications to start any other application component and potentially consume the data it produces
  • 21. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Component Activation ☐ Activities, Services and Broadcast Receivers are activated through an asynchronous message, called Intent ☐ For Activities and Services the intent specifies the action to perform ☐ For Broadcast Receivers it specifies the event being broadcasted, e.g. battery-low
  • 22. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Application Manifest ☐ The manifest is an XML file containing several important information about the application ☐ Among, other things, the manifest includes the authorization necessary for your application -- for instance, it is in this file that you have to mention that your application requires access to the network, etc.
  • 23. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Activities Lifecycle ☐ Notice that Activities are also destroyed each time there is a screen rotation (unless you don’t explicitly manage it)
  • 24. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Tasks and Back-Stack
  • 25. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS DDS-based and Android Apps Considering the Android application lifecycle, we should ask ourselves a few questions: ☐ When should we create DDS entities and who should hold a reference to them? ☐ What happens when an application is no more visible? ☐ Can I control when my application exits? ☐ How do I deal with multi-threading?
  • 27. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS DDS Chat for Android ☐ To learn how to write an Android Application that uses OpenSplice Mobile we’ll develop a very simple Chat ☐ To keep things simple this chat will have a single “chat room”
  • 28. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Step 1: Architecture ☐ Our Chat application will have a very simple architecture with a single just a single Activity that will take care of: ☐ Posting Chat Messages into the ChatRoom ☐ Displaying the Chat Messages Posted in the room since when we joined ☐ In terms of information modeling, we’ll have a single topic representing the user post struct ChatMessage { string user; string msg; }; #pragma keylist ChatMessage user
  • 29. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Step 2: Lifecycle Management ☐ Creating DDS entities, such as DomainParticipants, DataReaders and DataWriters involves network communication, such as discovery information ☐ In addition when an a DDS entity is destroyed it looses its state ☐ As such, tying the life-cycle of DDS entities to activities should be done with great care [1/2]
  • 30. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Step 2: Lifecycle Management ☐ In general, it is a better idea to tie the life-cycle of DDS entities to the Application as opposed to Activities ☐ In some cases, it may make sense to tie the life-cycle of DataReaders/ DataWriters to that of the activity that relies on them -- Usually this makes sense for activities that are “one-off” [2/2]
  • 31. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Application public class ChatApplication extends Application { DataReader<ChatMessage> dr; DataWriter <ChatMessage> dw; DomainParticipant dp; @Override public void onCreate() { super.onCreate(); // This should be defined via a resource -- but for a small // demo that’s OK. System.setProperty(ServiceEnvironment.IMPLEMENTATION_CLASS_NAME_PROPERTY, "org.opensplice.mobile.core.ServiceEnvironmentImpl"); ServiceEnvironment env = ServiceEnvironment.createInstance( ChatApplication.class.getClassLoader()); DomainParticipantFactory dpf = DomainParticipantFactory.getInstance(env); dp = dpf.createParticipant(0); Topic<ChatMessage> topic = dp.createTopic("TChatMessage",ChatMessage.class); Publisher pub = dp.createPublisher(); Subscriber sub = dp.createSubscriber(); dw = pub.createDataWriter(topic); dr = sub.createDataReader(topic); }
  • 32. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Application public DataReader<ChatMessage> reader() { return this.dr; } public DataWriter<ChatMessage> writer() { return this.dw; } @Override public void onTerminate() { super.onTerminate(); this.dp.close(); } }
  • 33. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Manifest... <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:name="ChatApplication" > <activity android:name="org.opensplice.mobile.ddschat.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
  • 34. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS More Manifest... ☐ When using OpenSplice Mobile you need to grant the proper permissions for networking: <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
  • 35. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Activity GUI <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/chatMessages" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/chat_msgs" android:visibility="gone" android:background="#666" android:textColor="#fff" android:paddingLeft="5dp" /> <ListView android:id="@+id/messageList" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" />
  • 36. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Activity GUI <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <EditText android:id="@+id/message" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="@string/edit_message" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="sendChatMessage" android:text="@string/button_send" /> </LinearLayout> </LinearLayout>
  • 37. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Activity 1 2 public class MainActivity extends Activity { 3 4 private static final String TAG = "ChatMainActivity"; 5 private final Handler handler = new Handler(); 6 private ArrayAdapter<String> chatMessages; 7 8 public class ChatMessageListener extends ChatMessageDataListener { 9 // ... 10 } 11 12 @Override 13 protected void onCreate(Bundle savedInstanceState) { 14 super.onCreate(savedInstanceState); 15 setContentView(R.layout.activity_main); 16 chatMessages = new ArrayAdapter<String>(this, R.layout.messages); 17 chatMessages.add("Welcome to the DDS Chat Room"); 18 ListView mview = (ListView) findViewById(R.id.messageList); 19 mview.setAdapter(chatMessages); 20 ChatApplication app = (ChatApplication) getApplication(); 21 22 app.reader().setListener(new ChatMessageListener()); 23 24 } 25
  • 38. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Activity 25 26 @Override 27 public boolean onCreateOptionsMenu(Menu menu) { 28 // Inflate the menu; this adds items to the action bar if it is present. 29 getMenuInflater().inflate(R.menu.main, menu); 30 return true; 31 }
  • 39. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Activity 32 33 public void sendChatMessage(View view) { 34 EditText editText = (EditText) findViewById(R.id.message); 35 String msg = editText.getText().toString(); 36 editText.setText(""); 37 // chatMessages.add(msg); 38 ChatApplication app = (ChatApplication) getApplication(); 39 try { 40 Log.i(TAG, ">>> Sending data " + msg); 41 app.writer().write(new ChatMessage(usr, msg)); 42 } catch (TimeoutException te) { 43 } 44 } 45 46 }
  • 40. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Receiving Data ☐ Receiving data is a bit trickier since in Android only the thread that runs an activity has the right to change the UI ☐ This means, that from a DDS listener it is not possible to change an the UI directly! ☐ The solution in to use an Android Handler  to which we can post Runnable to be executed by the activity thread ☐ Let’s see how this works
  • 41. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS DDS Listener & Android Handler 1 public class ChatMessageListener extends ChatMessageDataListener { 2 3 private DataReader<ChatMessage> dr; 4 5 public ChatMessageListener() { 6 ChatApplication app = (ChatApplication) getApplication(); 7 dr = app.reader(); 8 } 9
  • 42. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS DDS Listener & Android Handler 10 @Override 11 public void onDataAvailable(DataAvailableEvent<ChatMessage> dae) { 12 final Iterator<ChatMessage> i = dr.read(); 13 14 Log.i(TAG, ">>> DataReaderListener.onDataAvailable"); 15 if (i.hasNext()) { 16 Runnable dispatcher = new Runnable() { 17 public void run() { 18 while (i.hasNext()) { 19 Sample<ChatMessage> s = i.next(); 20 21 if (s.getSampleState() == SampleState.NOT_READ) { 22 ChatMessage cm = s.getData(); 23 chatMessages.add(cm.user + " > " + cm.msg); 24 } 25 } 26 } 27 }; 28 handler.post(dispatcher); 29 } 30 } 31 }
  • 45. Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSpliceDDS Concluding Remarks ☐ OpenSplice Mobile is the only pure Java DDS implementation available on the market. This means that it is the best choice for Java-Based DDS applications as well as Android Applications ☐ Its performance are very close to native C/C++ DDS implementations ☐ OpenSplice Mobile architecture is very flexible and can be easily configured to deliver extremely low latency as well as extremely high throughput