Habari Client for Activemq Version 5.2 2 Habari Client for Activemq 5.2
Total Page:16
File Type:pdf, Size:1020Kb
Getting started with Habari Client for ActiveMQ Version 5.2 2 Habari Client for ActiveMQ 5.2 LIMITED WARRANTY No warranty of any sort, expressed or implied, is provided in connection with the library, including, but not limited to, implied warranties of merchantability or fitness for a particular purpose. Any cost, loss or damage of any sort incurred owing to the malfunction or misuse of the library or the inaccuracy of the documentation or connected with the library in any other way whatsoever is solely the responsibility of the person who incurred the cost, loss or damage. Furthermore, any illegal use of the library is solely the responsibility of the person committing the illegal act. Trademarks Habari is a trademark or registered trademark of Michael Justin in Germany and/or other countries. Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. Embarcadero, the Embarcadero Technologies logos and all other Embarcadero Technologies product or service names are trademarks, service marks, and/or registered trademarks of Embarcadero Technologies, Inc. and are protected by the laws of the United States and other countries. IBM and WebSphere are trademarks of International Business Machines Corporation in the United States, other countries, or both. HornetQ, WildFly, JBoss and the JBoss logo are registered trademarks or trademarks of Red Hat, Inc. Mac OS is a trademark of Apple Inc., registered in the U.S. and other countries. Oracle, WebLogic and Java are registered trademarks of Oracle and/or its affiliates. Pivotal, RabbitMQ and the RabbitMQ logo are trademarks and/or registered trademarks of GoPivotal, Inc. in the United States and/or other countries. Other brands and their products are trademarks of their respective holders. Errors and omissions excepted. Specifications subject to change without notice. 3 Contents Broker-specific information..............................................................................7 Installation...........................................................................................8 Requirements...................................................................................................8 Development Environment................................................................................8 TCP/IP Communication Library...........................................................................8 Installation steps.............................................................................................8 Communication Adapters......................................................................9 Introduction.....................................................................................................9 Configuration of communication adapters............................................................9 Registration of communication adapter class.......................................................9 Available communication adapters....................................................................10 Limitations of the Synapse communication adapter class.....................................10 The Programming Model.....................................................................11 Tutorials..............................................................................................12 Quick Start Tutorial........................................................................................12 Setting up the project.....................................................................................12 Adding code to the project..............................................................................12 Run the demo................................................................................................14 Check for memory leaks..................................................................................14 Tutorial source code........................................................................................15 Map Message Tutorial.....................................................................................15 Setting up the project.....................................................................................15 Adding code to the project..............................................................................16 Run the demo................................................................................................18 Map Message Conversion with Apache ActiveMQ.................................................18 Tutorial source code........................................................................................19 Connections and Sessions...................................................................20 Step-by-Step Example....................................................................................20 Overview......................................................................................................20 Add required units..........................................................................................20 Creating a new Connection..............................................................................20 Connection URL Parameters.............................................................................21 Creating a Session.........................................................................................21 Using the Session...........................................................................................21 Closing a Connection......................................................................................22 Session types overview..................................................................................22 Connection URL parameters...........................................................................23 Message Receipts...........................................................................................23 Subscription Receipts......................................................................................23 Disconnect Receipts........................................................................................24 TCP Keep-Alive (only supported with Indy)........................................................24 Heart-beating Support....................................................................................25 Transacted Sessions.......................................................................................25 Create a transacted session.............................................................................25 Send messages..............................................................................................26 Committing a transaction................................................................................26 4 Habari Client for ActiveMQ 5.2 Rolling back a transaction................................................................................26 Transacted message acknowledgement.............................................................27 Failover Support.............................................................................................27 Failover Transport Options...............................................................................28 Destinations........................................................................................29 Introduction...................................................................................................29 Create a new Destination...............................................................................29 Queues.........................................................................................................29 Topics...........................................................................................................30 Producer and Consumer......................................................................31 Message Producer..........................................................................................31 Message Consumer.........................................................................................31 Message selector............................................................................................31 Asynchronous and synchronous receive.............................................................32 Should I use synchronous delivery or asynchronous receive?...............................32 Synchronous Receive......................................................................................32 Durable Subscriptions.........................................................................34 Description.....................................................................................................34 Creation........................................................................................................34 Temporary Queues..............................................................................35 Introduction...................................................................................................35 Library Support..............................................................................................35 Resource Management....................................................................................35 Message Options.................................................................................36 Standard Properties.......................................................................................36