Red Hat Jboss A-MQ 6.1 Client Connectivity Guide
Total Page:16
File Type:pdf, Size:1020Kb
Red Hat JBoss A-MQ 6.1 Client Connectivity Guide Creating and tuning clients connections to message brokers Last Updated: 2017-10-13 Red Hat JBoss A-MQ 6.1 Client Connectivity Guide Creating and tuning clients connections to message brokers JBoss A-MQ Docs Team Content Services [email protected] Legal Notice Copyright © 2014 Red Hat. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/ . In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates. XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project. The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community. All other trademarks are the property of their respective owners. Abstract Red Hat JBoss A-MQ supports a number of different wire protocols and message formats. This guide provides a quick reference for understanding how to configure connections between clients and message brokers. Table of Contents Table of Contents .C .H . A. P. T. .E . R. 1. .. I.N . T. .R . O. .D . U. .C . T. .I O. .N . .3 . 1.1. JBOSS A-MQ CLIENT APIS 3 1.2. PREPARING TO USE MAVEN 4 .C .H . A. P. T. .E . R. 2. N. A. .T .I .V . E. A. .C .T . I. V. .E .M . .Q . .C . L. I. E. N. .T . .A . P. .I S. .8 . 2.1. NATIVE JMS CLIENT API 8 2.2. NATIVE C++ CLIENT API 10 2.3. NATIVE .NET CLIENT API 14 2.4. CONFIGURING NMS.ACTIVEMQ 15 .C .H . A. P. T. .E . R. 3. Q. P. I. D. J. M. S. C. L. .I E. .N . T. A. .P . I. 2. .2 . 3.1. GETTING STARTED WITH AMQP 22 3.2. A SIMPLE MESSAGING PROGRAM IN JAVA JMS 34 3.3. APACHE QPID JNDI PROPERTIES FOR AMQP MESSAGING 36 3.4. JAVA JMS MESSAGE PROPERTIES 42 3.5. JMS MAPMESSAGE TYPES 43 3.6. JMS CLIENT LOGGING 45 3.7. CONFIGURING THE JMS CLIENT 45 .C .H . A. P. T. .E . R. 4. .S .T . O. .M . .P . .H . E. A. R. .T .B . E. .A . T. .S . 5. .5 . STOMP 1.1 HEARTBEATS 55 STOMP 1.0 HEARTBEAT COMPATIBILITY 56 .C .H . A. P. T. .E . R. 5. I. N. .T . R. .A . -. J. V. .M . C. O. N. .N . E. .C .T . I.O . .N . S. 5. .7 . OVERVIEW 57 EMBEDDED BROKERS 57 USING THE VM TRANSPORT 58 EXAMPLES 59 .C .H . A. P. T. .E . R. 6. P. .E . E. .R . .P . R. .O . T. .O . C. .O . L. 6. .0 . OVERVIEW 60 PEER ENDPOINT DISCOVERY 61 URI SYNTAX 61 SAMPLE URI 61 .C .H . A. P. T. .E . R. 7. .. M. E. S. .S . A. .G . E. P. .R . E. F. .E . T. C. .H . .B . E. .H . A. .V . I. O. .R . 6. .2 . OVERVIEW 62 CONSUMER SPECIFIC PREFETCH LIMITS 62 SETTING PREFETCH LIMITS PER BROKER 63 SETTING PREFETCH LIMITS PER CONNECTION 63 SETTING PREFETCH LIMITS PER DESTINATION 64 DISABLING THE PREFETCH EXTENSION LOGIC 64 .C .H . A. P. T. .E . R. 8. .M . E. .S .S . A. .G . E. R. .E . D. .E . L. I.V . E. .R . Y. 6. .6 . OVERVIEW 66 REDELIVERY PROPERTIES 66 CONFIGURING THE BROKER'S REDELIVERY PLUG-IN 67 CONFIGURING THE REDELIVERY USING THE BROKER URI 68 SETTING THE REDELIVERY POLICY ON A CONNECTION 68 SETTING THE REDELIVERY POLICY ON A DESTINATION 68 .I N. .D . E. .X . 6. .9 . 1 Red Hat JBoss A-MQ 6.1 Client Connectivity Guide 2 CHAPTER 1. INTRODUCTION CHAPTER 1. INTRODUCTION Abstract Red Hat JBoss A-MQ clients can connect to a broker using a variety of transports and APIs. The connections are highly configurable and can be tuned for the majority of use cases. 1.1. JBOSS A-MQ CLIENT APIS Transports and protocols Red Hat JBoss A-MQ uses OpenWire as its default on the wire message protocol. OpenWire is a JMS compliant wire protocol that is designed to be fully-featured and highly performant. It is the default protocol of JBoss A-MQ. OpenWire can use a number of transports including TCP, SSL, and HTTP. In addition to OpenWire, JBoss A-MQ clients can also use a number of other transports including: Simple Text Orientated Messaging Protocol(STOMP)—allows developers to use a wide variety of client APIs to connect to a broker. Discovery—allows clients to connect to one or more brokers without knowing the connection details for a specific broker. See Using Networks of Brokers. VM—allows clients to directly communicate with other clients in the same virtual machine. See Chapter 5, Intra-JVM Connections. Peer—allows clients to communicate with each other without using an external message broker. See Chapter 6, Peer Protocol. For details of using the different the transports see the Connection Reference. Supported Client APIs JBoss A-MQ provides a standard JMS client library. In addition to the standard JMS APIs the Java client library has a few implementation specific APIs. JBoss A-MQ also has a C++ client library and .Net client library that are developed as part of the Apache ActiveMQ project. You can download them from them from the Red Hat customer portal. You will need to compile them yourselves. NOTE This guide only deals with the JBoss A-MQ client libraries. The STOMP protocol allows you to use a number of other clients including: C clients C++ clients C# and .NET clients Delphi clients 3 Red Hat JBoss A-MQ 6.1 Client Connectivity Guide Flash clients Perl clients PHP clients Pike clients Python clients Configuration There are two types of properties that effects client connections: transport options—configured on the connection. These options are configured using the connection URI and may be set by the broker. They apply to all clients using the connection. destination options—configured on a per destination basis. These options are configured when the destination is created and impact all of the clients that send or receive messages using the destination. They are always set by clients. Some properties, like prefect and redelivery, can be configured as both connection options and destination oprions. 1.2. PREPARING TO USE MAVEN Overview This section gives a brief overview of how to prepare Maven for building Red Hat JBoss A-MQ projects and introduces the concept of Maven coordinates, which are used to locate Maven artifacts. Prerequisites In order to build a project using Maven, you must have the following prerequisites: Maven installation—Maven is a free, open source build tool from Apache. You can download the latest version from the Maven download page . Network connection—whilst performing a build, Maven dynamically searches external repositories and downloads the required artifacts on the fly. By default, Maven looks for repositories that are accessed over the Internet. You can change this behavior so that Maven will.