2015-01-05 07:45:36 -05: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.
-->
2014-10-31 06:20:28 -04:00
< html >
< head >
2015-05-13 06:12:07 -04:00
< title > ActiveMQ Artemis JMS Client-Side Load-Balancing Example< / title >
2015-08-10 10:41:52 -04:00
< 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 >
2014-10-31 06:20:28 -04:00
< / head >
< body onload = "prettyPrint()" >
< h1 > JMS Client-Side Load-Balancing Example< / h1 >
2015-08-05 15:33:20 -04:00
< 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 >
2014-10-31 06:20:28 -04:00
< p > This example demonstrates how connnections created from a single JMS Connection factory can be created
2015-05-13 06:12:07 -04:00
to different nodes of the cluster. In other words it demonstrates how ActiveMQ Artemis does < b > client side load balancing< / b > of
2014-10-31 06:20:28 -04:00
connections across the cluster.< / p >
< p > The particular load-balancing policy can be chosen to be random, round-robin or user-defined. Please see the user
guide for more details of how to configure the specific load-balancing policy. In this example we will use
the default round-robin load balancing policy.< / p >
2015-05-13 06:12:07 -04:00
< p > The list of servers over which ActiveMQ Artemis will round-robin the connections can either be specified explicitly
2014-10-31 06:20:28 -04:00
in the connection factory when instantiating it directly, when configuring it on the server or configured
to use UDP discovery to discover the list of servers over which to round-robin. This example will use UDP
discovery to obtain the list.< / p >
< p > This example starts three servers which all broadcast their location using UDP discovery. The UDP broadcast configuration
2015-04-29 05:30:31 -04:00
can be seen in the < code > broker.xml< / code > file.< / p >
2014-10-31 06:20:28 -04:00
< p > A JMS ConnectionFactory is deployed on each server specifying the discovery group that will be used by that
2015-08-05 15:33:20 -04:00
connection factory.< / p >
2015-05-13 06:12:07 -04:00
< p > For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering
2015-08-05 15:33:20 -04:00
section of the user manual.< / p >
2014-10-31 06:20:28 -04:00
2015-08-05 15:33:20 -04:00
< / body >
2015-01-05 07:45:36 -05:00
< / html >