Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A66E3200D49 for ; Fri, 24 Nov 2017 11:12:33 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A4A8C160C39; Fri, 24 Nov 2017 10:12:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 377D5160C16 for ; Fri, 24 Nov 2017 11:12:31 +0100 (CET) Received: (qmail 91810 invoked by uid 500); 24 Nov 2017 10:12:30 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 91582 invoked by uid 99); 24 Nov 2017 10:12:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Nov 2017 10:12:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A8C71F5F61; Fri, 24 Nov 2017 10:12:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: orudyy@apache.org To: commits@qpid.apache.org Date: Fri, 24 Nov 2017 10:12:34 -0000 Message-Id: <2342b744f56640388834815e8729f8f1@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/52] [partial] qpid-site git commit: NO-JIRA Qpid for Java 6.1.5 archived-at: Fri, 24 Nov 2017 10:12:33 -0000 http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring-Logging.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring-Logging.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring-Logging.html.in new file mode 100644 index 0000000..083da26 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring-Logging.html.in @@ -0,0 +1,9 @@ +

2.5. Logging

The JMS Client logging is handled using the Simple Logging Facade for Java (SLF4J). As the name implies, slf4j is a facade that delegates to other logging systems like log4j or JDK 1.4 logging. For more information on how to configure slf4j for specific logging syst ems, please consult the slf4j documentation.

When using the log4j binding, please set the log level for org.apache.qpid explicitly. Otherwise log4j will default to DEBUG which will degrade performance considerably due to excessive logging. The recommended logging level for production is WARN.

The following example shows the logging properties used to configure client logging for slf4j using the log4j binding. These properties can be placed in a log4j.properties file and placed in the CLASSPATH, or they can be set explicitly using the -Dlog4j.configuration property.

Example 2.11. log4j Logging Properties

+	log4j.logger.org.apache.qpid=WARN, console
+	log4j.additivity.org.apache.qpid=false
+
+	log4j.appender.console=org.apache.log4j.ConsoleAppender
+	log4j.appender.console.Threshold=all
+	log4j.appender.console.layout=org.apache.log4j.PatternLayout
+	log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n
+	

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring.html.in new file mode 100644 index 0000000..3d3edd4 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Configuring.html.in @@ -0,0 +1,11 @@ +

Chapter 2. Configuring the Client

2.1. Overview

This chapter covers various configuration details for the Apache Qpid JMS Client for AMQP 0-10, from the basics of setting up the client + using JNDI in Section 2.2, “JNDI Properties”, to the various configuration options avilable to + customize it's behaviour at different levels of granualarity, e.g:

  • + Connection level using Connection/Broker properties : Affects the respective connection and sessions, consumers and produces created by that connection. +

    Ex. amqp://guest:guest@test/test?maxprefetch='1000' + &brokerlist='tcp://localhost:5672' + property specifies the message credits to use. This overrides any value specified via the JVM argument max_prefetch.

    Please refer to the Section 2.2.2, “Connection URLs” section for a complete list of all properties and how to use them.

  • + JVM level using JVM arguments : Configuration that affects all connections, sessions, consumers and producers created within that JVM. +

    Ex. -Dmax_prefetch=1000 property specifies the message credits to use.

    Please refer to the Section 2.3, “JVM Properties” section for a complete list of all properties and how to use them.

  • + Destination level using Addressing options : Affects the producer(s) and consumer(s) created using the respective destination. +

    Ex. my-queue; {create: always, link:{capacity: 10}}, where capacity option specifies the message credits to use. This overrides any connection level configuration.

    Please refer to the Section 2.4, “Addresses” section for a complete understanding of addressing and it's various options.

Some of these config options are available at all three levels, while others are available only at JVM or connection level.

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Example.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Example.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Example.html.in new file mode 100644 index 0000000..ff83828 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Example.html.in @@ -0,0 +1,78 @@ +

Chapter 1. HelloWorld Example

The following program shows how to send and receive a + message using the Apache Qpid JMS client for AMQP 0-10 . JMS programs typically use + JNDI to obtain connection factory and destination objects which + the application needs. In this way the configuration is kept + separate from the application code itself.

In this example, we create a JNDI context using a + properties file, use the context to lookup a connection factory, + create and start a connection, create a session, and lookup a + destination from the JNDI context. Then we create a producer and + a consumer, send a message with the producer and receive it with + the consumer. This code should be straightforward for anyone + familiar with JMS.

Example 1.1. "Hello world!" in Java

+package org.apache.qpid.example.jmsexample.hello;
+
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+public class Hello {
+
+    public Hello() {
+    }
+
+    public static void main(String[] args) {
+        Hello producer = new Hello();
+        producer.runTest();
+    }
+
+    private void runTest() {
+        try {
+            Properties properties = new Properties();
+            properties.load(this.getClass().getResourceAsStream("hello.properties"));  1
+            Context context = new InitialContext(properties);   2
+
+            ConnectionFactory connectionFactory
+              = (ConnectionFactory) context.lookup("qpidConnectionfactory"); 3
+            Connection connection = connectionFactory.createConnection();  4
+            connection.start();  5
+
+            Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);6
+            Destination destination = (Destination) context.lookup("topicExchange");  7
+
+            MessageProducer messageProducer = session.createProducer(destination);  8
+            MessageConsumer messageConsumer = session.createConsumer(destination);  9
+
+            TextMessage message = session.createTextMessage("Hello world!");
+            messageProducer.send(message);
+
+            message = (TextMessage)messageConsumer.receive();    10
+            System.out.println(message.getText());
+
+            connection.close();  11
+            context.close();   12
+        }
+        catch (Exception exp) {
+            exp.printStackTrace();
+        }
+    }
+}
+

1

Loads the JNDI properties file, which specifies connection properties, queues, topics, and addressing options. See below for further details.

2

Creates the JNDI initial context.

3

Creates a JMS connection factory for Qpid.

4

Creates a JMS connection.

5

Activates the connection.

6

Creates a session. This session is not transactional (transactions='false'), and messages are automatically acknowledged.

7

Creates a destination for the topic exchange, so senders and receivers can use it.

8

Creates a producer that sends messages to the topic exchange.

9

Creates a consumer that reads messages from the topic exchange.

10

Reads the next available message.

11

Closes the connection, all sessions managed by the connection, and all senders and receivers managed by each session.

12

Closes the JNDI context.

The contents of the hello.properties file are shown below.

Example 1.2. JNDI Properties File for "Hello world!" example

+java.naming.factory.initial
+= org.apache.qpid.jndi.PropertiesFileInitialContextFactory
+
+# connectionfactory.[jndiname] = [ConnectionURL]
+connectionfactory.qpidConnectionfactory
+= amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' 1
+# destination.[jndiname] = [address_string]
+destination.topicExchange = amq.topic 2
+	

1

Defines a connection factory from which connections + can be created. The syntax of a ConnectionURL is given in + Section 2.2, “JNDI Properties”.

2

Defines a destination for which MessageProducers + and/or MessageConsumers can be created to send and receive + messages. The value for the destination in the properties + file is an address string as described in + Section 2.4, “Addresses”. In the JMS + implementation MessageProducers are analogous to senders in + the Qpid Message API, and MessageConsumers are analogous to + receivers.

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous-MapMessages.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous-MapMessages.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous-MapMessages.html.in new file mode 100644 index 0000000..32bda63 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous-MapMessages.html.in @@ -0,0 +1,48 @@ +

3.2. JMS MapMessage Types

Qpid supports the JMS MapMessage interface, which provides support for maps in messages. The following code shows how to send a MapMessage in JMS.

Example 3.1. Sending a JMS MapMessage

+	import java.util.ArrayList;
+	import java.util.HashMap;
+	import java.util.List;
+	import java.util.Map;
+
+	import javax.jms.Connection;
+	import javax.jms.Destination;
+	import javax.jms.MapMessage;
+	import javax.jms.MessageProducer;
+	import javax.jms.Session;
+
+	import java.util.Arrays;
+
+	// !!! SNIP !!!
+
+	MessageProducer producer = session.createProducer(queue);
+
+	MapMessage m = session.createMapMessage();
+	m.setIntProperty("Id", 987654321);
+	m.setStringProperty("name", "Widget");
+	m.setDoubleProperty("price", 0.99);
+
+	List<String> colors = new ArrayList<String>();
+	colors.add("red");
+	colors.add("green");
+	colors.add("white");
+	m.setObject("colours", colors);
+
+	Map<String,Double> dimensions = new HashMap<String,Double>();
+	dimensions.put("length",10.2);
+	dimensions.put("width",5.1);
+	dimensions.put("depth",2.0);
+	m.setObject("dimensions",dimensions);
+
+	List<List<Integer>> parts = new ArrayList<List<Integer>>();
+	parts.add(Arrays.asList(new Integer[] {1,2,5}));
+	parts.add(Arrays.asList(new Integer[] {8,2,5}));
+	m.setObject("parts", parts);
+
+	Map<String,Object> specs = new HashMap<String,Object>();
+	specs.put("colours", colors);
+	specs.put("dimensions", dimensions);
+	specs.put("parts", parts);
+	m.setObject("specs",specs);
+
+	producer.send(m);
+	

The following table shows the datatypes that can be sent in a MapMessage, and the corresponding datatypes that will be received by clients in Python or C++.

Table 3.2. Java Datatypes in Maps

Java DatatypePythonC++
booleanboolbool
shortint | longint16
intint | longint32
longint | longint64
floatfloatfloat
doublefloatdouble
java.lang.Stringunicodestd::string
java.util.UUIDuuidqpid::types::Uuid
java.util.Map[a]dictVariant::Map
java.util.ListlistVariant::List

[a] In Qpid, maps can nest. This goes beyond the functionality required by the JMS specification.


\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous.html.in new file mode 100644 index 0000000..0a90239 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/JMS-Client-0-10-Miscellaneous.html.in @@ -0,0 +1,8 @@ +

Chapter 3. Miscellaneous

3.1. JMS Message Properties

The following table shows how Qpid Messaging API message + properties are mapped to AMQP 0-10 message properties and + delivery properties. In this table msg + refers to the Message class defined in the Qpid Messaging API, + mp refers to an AMQP 0-10 + message-properties struct, and + dp refers to an AMQP 0-10 + delivery-properties struct.

Table 3.1. JMS Mapping to AMQP 0-10 Message Properties

JMS Message PropertyAMQP 0-10 Property[a]
JMSMessageIDmp.message_id
qpid.subject[b]mp.application_headers["qpid.subject"]
JMSXUserIDmp.user_id
JMSReplyTomp.reply_to[c]
JMSCorrelationIDmp.correlation_id
JMSDeliveryM odedp.delivery_mode
JMSPrioritydp.priority
JMSExpirationdp.ttl[d]
JMSRedelivereddp.redelivered
JMS Propertiesmp.application_headers
JMSTypemp.content_type

[a] In these entries, mp refers to an AMQP message property, and dp refers to an AMQP delivery property.

[b] This is a custom JMS property, set automatically by the JMS client implementation.

[c] The reply_to is converted from the protocol representation into an address.

[d] JMSExpiration = dp.ttl + currentTime


\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/css/style.css ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/css/style.css b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/css/style.css new file mode 100644 index 0000000..8179bf4 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/css/style.css @@ -0,0 +1,131 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +ul { + list-style-type:square; +} + +th { + font-weight: bold; +} + +.navfooter td { + font-size:10pt; +} + +.navheader td { + font-size:10pt; +} + +body { + margin:0; + background:#FFFFFF; + font-family:"Verdana", sans-serif; + font-size:10pt; +} + +.container { + width:950px; + margin:0 auto; +} + +body a { + color:#000000; +} + + +div.book { + margin-left:10pt; + margin-right:10pt; +} + +div.preface { + margin-left:10pt; + margin-right:10pt; +} + +div.chapter { + margin-left:10pt; + margin-right:10pt; +} + +div.section { + margin-left:10pt; + margin-right:10pt; +} + +div.titlepage { + margin-left:-10pt; + margin-right:-10pt; +} + +.calloutlist td { + font-size:10pt; +} + +.table-contents table { + border-spacing: 0px; +} + +.table-contents td { + font-size:10pt; + padding-left:6px; + padding-right:6px; +} + +.chapter h2.title { + font-size:20pt; + color:#0c3b82; +} + +.chapter .section h2.title { + font-size:18pt; + color:#0c3b82; +} + +.section h2.title { + font-size:16pt; + color:#0c3b82; +} + +.section h3.title { + font-size:14pt; + color:#0c3b82; +} + +.section h4.title { + font-size:12pt; + color:#0c3b82; +} + +.section h5.title { + font-size:12pt; + color:#0c3b82; +} + +.section h6.title { + font-size:12pt; + color:#0c3b82; +} + +.toc a { + font-size:9pt; +} + http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-10/book/index.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-10/book/index.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/index.html.in new file mode 100644 index 0000000..fac5360 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-10/book/index.html.in @@ -0,0 +1 @@ +

Apache Qpid JMS Client for AMQP 0-10


\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Exceptions.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Exceptions.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Exceptions.html.in new file mode 100644 index 0000000..b6ab4b0 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Exceptions.html.in @@ -0,0 +1,48 @@ +

Appendix A. Exceptions

The methods of the Client throw JMSExceptions in response to error + conditions. Typically the exception's message (#getMessage()) summarises the error condition, + with contextual information being provided by the messages of linked exception(s). To understand + the problem, it is important to read the messages associated with all the + linked exceptions.

The following table describes some of the more common exceptions linked to JMSException + thrown by JMS methods whilst using the client:

Table A.1. Exceptions linked to JMSExceptions thrown by JMS methods

Linked ExceptionMessageExplanation/Common Causes
AMQUnresolvedAddressExceptionmessage varies

Indicates that the hostname included in the Connection URL's brokerlist, could not be resolved, . This could mean that the hostname is + mispelt, or there is name resolution problem.

AMQConnectionFailureConnection refused

Indicates that the host included in the Connection URL's brokerlist, actively refused the connection. This could mean that the + hostname and/or port number is incorrect, or the Broker may not be + running.

AMQConnectionFailureconnect timed out

Indicates that the host included in the Connection URL's brokerlist, could not be contacted within the connecttimeout. This could mean that the host is shutdown, or a networking + routing problem means the host is unreachable.

AMQConnectionFailureGeneral SSL Problem; PKIX path building failed; unable to find valid certification + path to requested target

Indicates that the CA that signed the Broker's certificate is not trusted by + the JVM of the client. If the Broker is using a private-CA (or a self signed + certificate) check that the client has been properly configured with a truststore. See + Section 5.3.3, “SSL”

AMQConnectionFailure / AMQAuthenticationExceptionnot allowed

Indicates that the user cannot be authenticated by the Broker. Check the + username and/or password elements within the Connection URL.

AMQConnectionFailure / AMQSecurityExceptionPermission denied: virtualhost name; access refused

Indicates that the user is not authorised to connect to the given + virtualhost. The user is recognised by the Broker and is using the correct password + but does not have permission. This exception normally indicates that the user (or + group) has not been permissioned within the Broker's Access Control List + (ACL).

AMQTimeoutExceptionServer did not respond in a timely fashion; Request Timeout

Indicates that the broker did not respond to a request sent by the client in + a reasonable length of time. The timeout is governed by qpid.sync_op_timeout.

This can be a symptom + of a heavily loaded broker that cannot respond or the Broker may have failed in + unexpected manner. Check the broker and the host on which it runs and performance of + its storage.

AMQSecurityExceptionPermission denied: message varies

Indicates that the user is not authorised to use the given resource or + perform the given operation. This exception normally indicates that the user (or + group) has not been permissioned within the Broker's Access Control List + (ACL).

CertificateExceptionUnable to find certificate for recipient '<recipient>' +

When using end to end message encryption, this exception indicates the the message recipent's + principal cannot be found in the truststore. See Chapter 9, Message Encryption +

+

The following table describes some of the more common exceptions linked to JMSException sent + to ExceptionListener + instances.

Table A.2. Exceptions linked to JMSExceptions received by ExceptionListeners

Linked ExceptionMessageExplanation/Common Causes
AMQNoRouteExceptionNo Route for message [Exchange: exchange name, Routing key: + routing key] [error code 312: no route]

Indicate that the named exchange is unable to route a message to at least one + queue.

+

This will occur if a queue has been improperly bound to an exchange. Use the + Broker's management interface to check the bindings. See Section 5.5.1, “Mandatory Messages”

AMQNoConsumersExceptionImmediate delivery is not possible. [error code 313: no consumers]

Immediate delivery was requested by the MessageProducer, but as there are no + consumers on any target queue, the message has been returned to the publisher. See + Section 5.5.3, “Immediate Messages” +

AMQDisconnectedExceptionServer closed connection and reconnection not permitted

Indicates that the connection was closed by the Broker, and as failover + options are not included in the Connection URL, the client has been unable to + reestablish connection.

+

The Connection is now closed and any attempt to use either Connection object, or + any objects created from the Connection will receive an IllegalStateException.

AMQDisconnectedExceptionServer closed connection and no failover was successful

Indicates that the connection was closed by the Broker. The client has tried + failover according to the rules of the failover + optionswithin the Connection URL, but these attempts were all + unsuccessful.

+

The Connection is now closed and any attempt to use either Connection object, or + any objects created from the Connection will receive an IllegalStateException.


\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions-Binding.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions-Binding.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions-Binding.html.in new file mode 100644 index 0000000..4256c0f --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions-Binding.html.in @@ -0,0 +1,20 @@ +

C.2. Binding Management

These extensions allow bindings to be created or removed.

C.2.1. Binding creation

The following example illust rates the creation of queue binding to topic exchange with + JMS client.

Example C.2. Binding a queue using JMS

ConnectionFactory connectionFactory = ...
+Connection connection = connectionFactory.createConnection();
+AMQSession<?, ?> session = (AMQSession<?,?>)connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+...
+
+AMQShortString queueName = new AMQShortString("testQueue");
+AMQShortString routingKey = new AMQShortString("testRoutingKey");
+AMQDestination destination = (AMQDestination) session.createQueue(queueName.asString());
+
+...
+
+// binding arguments
+Map<String, Object> arguments = new HashMap<String, Object>();
+arguments.put("x-filter-jms-selector", "application='app1'");
+
+// create binding
+session.bindQueue(queueName, routingKey, FieldTable.convertToFieldTable(arguments),
+    new AMQShortString("amq.topic"), destination);

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions.html.in new file mode 100644 index 0000000..653fbee --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-JMS-Extensions.html.in @@ -0,0 +1,15 @@ +

Appendix C. JMS Extensions

This section illustrates using Qpid specific extentions to JMS for the managament of queues, + exchanges and bindings.

Important

It is not recommended that these extensions are generally used. These interfaces are + subject to change and will not be supported in this form for AMQP 1.0. Instead, the reader is + directed towards the Managment interfaces of the Broker.

C.1. Queue Management

These extensions allow queues to be created or removed.

C.1.1. Queue creation

The following example illustrates the creation of the a LVQ queue from a + javax.jms.Session object. Note that this utilises a Qpid specific extension to JMS and + involves casting the session object back to its Qpid base-class.

Example C.1. Creation of an LVQ using the Qpid extension to JMS

Map<String,Object> arguments = new HashMap<String, Object>();
+arguments.put("qpid.last_value_queue_key","ISIN");
+AMQDestination amqQueue = (AMQDestination) context.lookup("myqueue");
+((AMQSession<?,?>) session).createQueue(
+        AMQShortString.valueOf(amqQueue.getQueueName()),
+        amqQueue.isAutoDelete(),
+        amqQueue.isDurable(),
+        amqQueue.isExclusive(),
+        arguments);
+

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Maven.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Maven.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Maven.html.in new file mode 100644 index 0000000..f39de7b --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Maven.html.in @@ -0,0 +1,32 @@ +

Appendix B. Minimal Maven POM

The following is a minimal Maven POM required to use the Qpid Client. It is suitable for + use with the examples included in this + book.

Example B.1. Minimal Maven POM

+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>test</groupId>
+  <artifactId>test</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.qpid</groupId>
+      <artifactId>qpid-client</artifactId>
+      <version>6.1.5</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.6.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jms_1.1_spec</artifactId>
+      <version>1.1.1</version>
+    </dependency>
+  </dependencies>
+</project>
+
+  

Note: We use the SLF4J Binding for Log4J12 here, but any SLF4J Binding could be used + instead. Similarly, Geronimo JMS Spec is used, but any dependency that provides the JMS 1.1 + specification could be substituted.

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-PooledConnecytionFactory.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-PooledConnecytionFactory.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-PooledConnecytionFactory.html.in new file mode 100644 index 0000000..fc69065 --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-PooledConnecytionFactory.html.in @@ -0,0 +1,52 @@ +

Appendix D. PooledConnectionFactory

Qpid client provides PooledConnectionFactory which is a special + implementation of ConnectionFactory supporting Connection pooling.

The PooledConnectionFactory caches a predefined number of connections + thus saving an application which connects frequently time. The Connection + instance is taken from the pool whenever method + PooledConnectionFactory#createConnection() is invoked and returned into the + pool when method Connection#close() is called.

A user can configure a maximum allowed number of connections to remain in pool (10 by + default) by calling PooledConnectionFactory#setMaxPoolSize(int). When number + of connections exceeds the value set for maximum pool size, + PooledConnectionFactory starts to work as a normal ConnectionFactory and creates + a new connection every time method PooledConnectionFactory#createConnection() + is invoked.

The Connection URL is set by invoking + method PooledConnectionFactory#setConnectionURLString(String).

A user can specify the maximum time a connection may remain idle in pool by calling + PooledConnectionFactory#setConnectionTimeout(long) passing a value in + milliseconds. If connection is not used within the specified interval it is closed + automatically.

This implementation can be useful in Spring JMS based applications. An + example below demonstrates how to configure PooledConnectionFactory in the + Spring xml configuration.

Example D.1. Example of configuring PooledConnectionFactory in spring xml + configuration.

+<bean id="pooledConnectionFactory" class="org.apache.qpid.client.PooledConnectionFactory">
+  <!-- set maximum number of pool connections to 20-->
+  <property name="maxPoolSize" value="20"></property>
+  <!-- set the timeout for connection to remain open in pool without being used -->
+  <property name="connectionTimeout" value="60000"></property>
+  <!-- set connection URL as String -->
+  <property name="connectionURLString" value="amqp://guest:guest@clientid/default?brokerlist='tcp://localhost:5672?retries='300'&failover='nofailover''&maxprefetch='0'"></property>
+</bean>


+

+ PooledConnectionFactory spring bean can be configured with such + spring-jms beans like + DefaultMessageListenerContainer and JmsTemplate. The + example below demonstrates how to do that

Example D.2. Examples of configuring PooledConnectionFactory with + DefaultMessageListenerContainer and + JmsTemplate.

+<bean id="jmsProducerTemplate" class="org.springframework.jms.core.JmsTemplate">
+    <!-- set reference to pooledConnectionFactory bean -->
+    <property name="connectionFactory" ref="pooledConnectionFactory"></property>
+    <property name="defaultDestination" ref="destination" />
+</bean>
+
+<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
+    <!-- set reference to pooledConnectionFactory bean -->
+    <property name="connectionFactory" ref="pooledConnectionFactory"/>
+    <property name="destination" ref="destination"/>
+    <property name="messageListener" ref="messageListener" />
+</bean>


+

Note

If using DefaultMessageListenerContainer with + cacheLevel set to NONE it is important that + maxConcurrentConsumer does not exceed the value of maximum pool size set + on PooledConnectionFactory bean. If this is not the case, once the number + of in-use connections reaches the the PooledConnectionFactory#maxPoolSize + a new connection will be opened for each and every message receipt i.e. a connection per + message anti-pattern.

\ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-site/blob/5f06b01e/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Tomcat-JNDI-Integration.html.in ---------------------------------------------------------------------- diff --git a/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Tomcat-JNDI-Integration.html.in b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Tomcat-JNDI-Integration.html.in new file mode 100644 index 0000000..5ff247e --- /dev/null +++ b/input/releases/qpid-java-6.1.5/jms-client-0-8/book/JMS-Client-0-8-Appendix-Tomcat-JNDI-Integration.html.in @@ -0,0 +1,123 @@ +

Appendix E. How to bind Qpid destinations and connection factories into Tomcat JNDI

+ Qpid client destinations and connection factories can be registered in external JNDI containers, for example, Tomcat JNDI implementation. +

+ org.apache.qpid.jndi.ObjectFactory implements + javax.naming.spi.ObjectFactory + allowing it to create instances of AMQConnectionFactory, PooledConnectionFactory, + AMQConnection, AMQQueue and AMQTopic in external JNDI container from + javax.naming.References. +

Additionally, + AMQConnectionFactory, PooledConnectionFactory and AMQDestination (parent of + AMQQueue and AMQTopic) implement + javax.naming.Referenceable + allowing creation of javax.naming.Reference objects + for binding in external JNDI implementations. +

+ org.apache.qpid.jndi.ObjectFactory allows the creation of: +

+

Note

+ For AMQQueue and AMQTopic prefix BURL: need + to be specified for Binding URL. Otherwise, client will try + to parse content using Address format. +

+

An example below demonstrates how to create JNDI resources in the Tomcat container using Resource declarations in context.xml + (A Tomcat specific web application configuration file usually added into war under /META-INF/context.xml). +

Example E.1. An example of Tomcat context.xml declaring Qpid JNDI resources

+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE xml>
+<Context>
+
+  <Resource name="jms/connectionFactory" auth="Container"
+            type="org.apache.qpid.client.AMQConnectionFactory"
+            factory="org.apache.qpid.jndi.ObjectFactory"
+            connectionURL="amqp://guest:guest@clientid/?brokerlist='localhost:5672'"/>
+
+  <Resource name="jms/pooledConnectionFactory" auth="Container"
+            type="org.apache.qpid.client.PooledConnectionFactory"
+            factory="org.apache.qpid.jndi.ObjectFactory"
+            connectionURL="amqp://guest:guest@clientid/?brokerlist='localhost:5672'"
+            maxPoolSize="20" connectionTimeout="60000"/>
+
+  <Resource name="jms/queue" auth="Container"
+            type="org.apache.qpid.client.AMQQueue"
+            factory="org.apache.qpid.jndi.ObjectFactory"
+            address="BURL:direct://amq.direct//myQueue?durable='true'"/>
+
+  <Resource name="jms/topic" auth="Container"
+            type="org.apache.qpid.client.AMQTopic"
+            factory="org.apache.qpid.client.AMQConnectionFactory"
+            address="BURL:topic://amq.topic//myTopic?routingkey='myTopic'"/>
+
+</Context>

In the example above AMQConnectionFactory would be registered under JNDI name "jms/connectionFactory", + PooledConnectionFactory would be registered under JNDI name "jms/pooledConnectionFactory", + Queue "myQueue" would be registered under JNDI name "jms/queue" and JMS Topic + destination "myTopic" would be registered under JNDI name "jms/topic". (All resources will be bound under "java:comp/env"). + On declaration of PooledConnectionFactory optional maxPoolSize and connectionTimeout are set to + 20 and 60000 milliseconds accordingly. +

+ The client application can find the resources declared in Tomcat context.xml using the code below: +

Example E.2. An example of JNDI lookup for Qpid resources registered in Tomcat JNDI

+    Context context = new InitialContext();
+    Context environmentContext = (Context)context.lookup("java:comp/env");
+    ...
+    ConnectionFactory connectionFactory = (ConnectionFactory) environmentContext.lookup("jms/connectionFactory");
+    ...
+    Queue queue = (Queue)environmentContext.lookup("jms/queue");
+    ...
+    Topic topic = (Topic)environmentContext.lookup("jms/topic");
+    ...

Note

+ In order to support backward compatibility AMQConnectionFactory continues to implement + javax.naming.spi.ObjectFactory + and can be used to instantiate JNDI resources from + javax.naming.References. + However, its method getObjectInstance is marked as Deprecated and will be + removed in future version of client. For backward compatibility, Qpid JNDI resources can be declared using fully + qualified class names as addresses. That will became unsupported in future version as well. + An example of Tomcat context.xml with declarations of JNDI resources using deprecated factory and addresses is provided below. +

Example E.3. An example of Tomcat context.xml declaring Qpid JNDI resources using deprecated ObjectFactory and deprecated addresses

+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE xml>
+<Context>
+
+  <Resource name="jms/queue" auth="Container"
+            type="org.apache.qpid.client.AMQQueue"
+            factory="org.apache.qpid.client.AMQConnectionFactory"
+            org.apache.qpid.client.AMQQueue="direct://amq.direct//myDurableQueue?durable='true'"/>
+
+  <Resource name="jms/topic" auth="Container"
+            type="org.apache.qpid.client.AMQTopic"
+            factory="org.apache.qpid.client.AMQConnectionFactory"
+            org.apache.qpid.client.AMQTopic="topic://amq.topic//myTopic?routingkey='myTopic'"/>
+
+  <Resource name="jms/connectionFactory" auth="Container"
+            type="org.apache.qpid.client.AMQConnectionFactory"
+            factory="org.apache.qpid.client.AMQConnectionFactory"
+            org.apache.qpid.client.AMQConnectionFactory="amqp://guest:guest@clientid/?brokerlist='localhost:5672'"/>
+
+</Context>


+

\ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org