Responsive Mobile User Experience Using MQTT and IBM Messagesight
Total Page:16
File Type:pdf, Size:1020Kb
Front cover Responsive Mobile User Experience Using MQTT and IBM MessageSight Learn how to connect mobile customers to your existing messaging enterprise system See a quick start guide for IBM MessageSight Understand mobile application development scenarios Whei-Jen Chen Rahul Gupta Valerie Lampkin Dale M Robertson Nagesh Subrahmanyam ibm.com/redbooks International Technical Support Organization Responsive Mobile User Experience Using MQTT and IBM MessageSight March 2014 SG24-8183-00 Note: Before using this information and the product it supports, read the information in “Notices” on page ix. First Edition (March 2014) This edition applies to IBM MessageSight Version 1.0.0.1, IBM WebSphere MQ Version 7.5.1, IBM Integration Bus Version 9 © Copyright International Business Machines Corporation 2014. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Notices . ix Trademarks . x Preface . xi Authors . xii Acknowledgements . xiii Now you can become a published author, too! . xiv Comments welcome. xv Stay connected to IBM Redbooks . xv Chapter 1. Introduction. 1 1.1 Challenges . 2 1.2 IBM product solutions . 3 1.2.1 IBM MessageSight . 3 1.2.2 IBM WebSphere MQ . 5 1.2.3 IBM Worklight . 6 1.2.4 IBM Integration Bus (formerly WebSphere Message Broker) . 6 1.2.5 IBM InfoSphere Streams. 7 1.3 MQTT advantages (versus HTTP) . 8 1.4 Mobile user experience scenarios with MQTT and IBM MessageSight . 9 1.4.1 Connected car. 10 1.4.2 Connected city . 11 1.4.3 Connected home. 12 1.4.4 Connected retail consumers . 13 Chapter 2. IBM MessageSight and MQTT . 15 2.1 MQTT protocol . 16 2.1.1 Eclipse Paho project . 18 2.1.2 OASIS . 19 2.2 Features of IBM MessageSight . 20 2.3 Getting started. 22 2.4 Configuration and administration. 24 2.4.1 Command-line interface . 24 2.4.2 The web UI . 27 2.4.3 Displaying the firmware version in the web UI . 31 2.4.4 Configuring message hubs . 33 © Copyright IBM Corp. 2014. All rights reserved. iii Chapter 3. Integration with enterprise systems . 39 3.1 WebSphere MQ connectivity and destination mapping. 40 3.2 JMS connectivity with IBM Integration Bus . 46 3.2.1 JMS integration with WebSphere MQ as the JMS provider . 47 3.2.2 JMS integration with IBM MessageSight as the JMS provider . 54 3.3 Developing stand-alone applications using the IBM MessageSight JMS classes . 61 3.3.1 IBM MessageSight JMS Client Pack. 61 3.3.2 IBM MessageSight JMS and JNDI . 62 3.3.3 Message delivery in IBM MessageSight . 62 3.3.4 A sample JMS publisher . 63 3.3.5 A sample JMS subscriber . 71 3.4 IBM MessageSight resource adapter for Java Platform Enterprise Edition applications. 75 Chapter 4. Security in IBM MessageSight. 77 4.1 Authentication of a device connecting with IBM MessageSight . 78 4.1.1 Users and groups . 78 4.1.2 Creating a user ID and group with the web UI . 79 4.1.3 Creating a user ID and group on the command line . 80 4.2 Authorization of a device connecting with IBM MessageSight . 81 4.2.1 Authorization schemes . 81 4.2.2 Authorizing MQTT clients . 81 4.2.3 Setting up authorization in IBM MessageSight: Connection policy . 83 4.2.4 Setting up authorization in IBM MessageSight: Messaging policy . 85 4.3 Transport Layer Security . 87 4.3.1 Certificate profile . 87 4.3.2 Security profile . 89 4.3.3 Associating a security profile with an endpoint . 91 4.3.4 Adding trusted certificates. 92 4.4 Combining TLS with connection and messaging policy . 94 4.4.1 Overview of TLS, connection policies, and messaging policies . 95 4.4.2 Identities in a security setup with TLS, connection policies, and messaging policies for an MQTT client. 96 Chapter 5. MQTT with mobile platforms . 99 5.1 Mobile application development considerations . 100 5.2 Mobile application development models . 101 5.2.1 Web application (browser access) development. 102 5.2.2 Hybrid application (web) development . 103 5.2.3 Hybrid application (mixed) development . 103 5.2.4 Native development . 103 5.2.5 Comparing the different approaches. 103 iv Responsive Mobile User Experience Using MQTT and IBM MessageSight 5.3 IBM Worklight . 105 5.3.1 IBM Worklight Studio. 106 5.3.2 IBM Worklight Device Runtime Components . 110 5.4 Mobile technologies. 113 5.4.1 Android software stack . 113 5.4.2 Device API specification . 114 5.4.3 Apache Cordova . 114 5.4.4 HTML5 . 115 5.4.5 Eclipse Paho . 118 5.4.6 SQLite database . 119 5.5 MQTT hybrid application for Android using IBM Worklight . 120 5.6 Configuring the Android SDK and test environment . 121 5.6.1 Android SDK tools. 122 5.6.2 Downloading and installing the ADT bundle . 124 5.6.3 Installing IBM Worklight studio in Android SDK . 126 5.6.4 Configuring the Android emulator . 128 5.7 MQTT hybrid application use case and requirements. 130 5.7.1 About the company . 130 5.7.2 Business problem . 130 5.7.3 Application requirements. 131 5.7.4 Application use cases . 133 5.7.5 Application visual blueprint . 136 5.7.6 Topic strings used for publish and subscribe . 138 5.8 Developing an MQTT hybrid application for Android. 143 5.8.1 Creating an IBM Worklight project and Worklight environment. 143 5.8.2 Creating.