mirror of
https://github.com/apache/activemq-artemis.git
synced 2025-02-06 10:09:01 +00:00
<!-- 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. --> <html> <head> <title>ActiveMQ Artemis JMS Instantiate Connection Factory Example</title> <link rel="stylesheet" type="text/css" href="../../../common/common.css" /> <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" /> <script type="text/javascript" src="../../../common/prettify.js"></script> </head> <body onload="prettyPrint()"> <h1>JMS Instantiate Connection Factory Example</h1> <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre> <p>Usually, JMS Objects such as ConnectionFactories, Queue and Topic instances are looked up from JNDI before being used by the client code. This objects are called "administered objects" in JMS specification terminology.</p> <p>However, in some cases a JNDI server may not be available or desired. To come to the rescue ActiveMQ also supports the direct instantiation of these administered objects on the client side.</p> <p>This allows the full set of JMS functionality to be available without requiring a JNDI server!</p> <p>This example is very simple and based on the simple Queue example, however in this example we instantiate the JMS Queue and ConnectionFactory objects directly.</p> <p>A wide variety of methods are available for instantiating ConnectionFactory objects. In this example we use a simple method which just takes the server connection details so it knows where to make the connection to.</p> <p>Other methods are available so all the connection factory parameters can be specified including specifying UDP discovery so the client does not need hard-wired knowledge of where the servers are that it wishes to connect to, or for specifying live-backup pairs of servers for failover.</p> <p>For more information on instantiating ConnectionFactories directly please consult the user manual and javadoc.</p> </body> </html>