| |
| <!DOCTYPE HTML> |
| <html lang="" > |
| <head> |
| <meta charset="UTF-8"> |
| <title>Client Failover ยท ActiveMQ Artemis Documentation</title> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| <meta name="description" content=""> |
| <meta name="generator" content="HonKit 4.0.7"> |
| |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/style.css"> |
| |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/@honkit/honkit-plugin-highlight/website.css"> |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css"> |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <meta name="HandheldFriendly" content="true"/> |
| <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> |
| <meta name="apple-mobile-web-app-capable" content="yes"> |
| <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> |
| <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon"> |
| |
| |
| <link rel="next" href="diverts.html" /> |
| |
| |
| <link rel="prev" href="jms-bridge.html" /> |
| |
| |
| </head> |
| <body> |
| |
| <div class="book honkit-cloak"> |
| <div class="book-summary"> |
| |
| |
| <div id="book-search-input" role="search"> |
| <input type="text" placeholder="Type to search" /> |
| </div> |
| |
| |
| <nav role="navigation"> |
| |
| |
| |
| <ul class="summary"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="chapter " data-level="1.1" data-path="./"> |
| |
| <a href="./"> |
| |
| |
| Introduction |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.2" data-path="notice.html"> |
| |
| <a href="notice.html"> |
| |
| |
| Legal Notice |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.3" data-path="preface.html"> |
| |
| <a href="preface.html"> |
| |
| |
| Preface |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.4" data-path="project-info.html"> |
| |
| <a href="project-info.html"> |
| |
| |
| Project Info |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.5" data-path="versions.html"> |
| |
| <a href="versions.html"> |
| |
| |
| Versions |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.6" data-path="messaging-concepts.html"> |
| |
| <a href="messaging-concepts.html"> |
| |
| |
| Messaging Concepts |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.7" data-path="architecture.html"> |
| |
| <a href="architecture.html"> |
| |
| |
| Architecture |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.8" data-path="using-server.html"> |
| |
| <a href="using-server.html"> |
| |
| |
| Using the Server |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.9" data-path="upgrading.html"> |
| |
| <a href="upgrading.html"> |
| |
| |
| Upgrading |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.10" > |
| |
| <span> |
| |
| |
| Address |
| |
| </span> |
| |
| |
| |
| <ul class="articles"> |
| |
| |
| <li class="chapter " data-level="1.10.1" data-path="address-model.html"> |
| |
| <a href="address-model.html"> |
| |
| |
| Model |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.10.2" data-path="address-settings.html"> |
| |
| <a href="address-settings.html"> |
| |
| |
| Settings |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| </ul> |
| |
| </li> |
| |
| <li class="chapter " data-level="1.11" data-path="protocols-interoperability.html"> |
| |
| <a href="protocols-interoperability.html"> |
| |
| |
| Protocols and Interoperability |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.12" data-path="amqp.html"> |
| |
| <a href="amqp.html"> |
| |
| |
| AMQP |
| |
| </a> |
| |
| |
| |
| <ul class="articles"> |
| |
| |
| <li class="chapter " data-level="1.12.1" data-path="amqp-broker-connections.html"> |
| |
| <a href="amqp-broker-connections.html"> |
| |
| |
| Broker Connections |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| </ul> |
| |
| </li> |
| |
| <li class="chapter " data-level="1.13" data-path="mqtt.html"> |
| |
| <a href="mqtt.html"> |
| |
| |
| MQTT |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.14" data-path="stomp.html"> |
| |
| <a href="stomp.html"> |
| |
| |
| STOMP |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.15" data-path="openwire.html"> |
| |
| <a href="openwire.html"> |
| |
| |
| OpenWire |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.16" data-path="core.html"> |
| |
| <a href="core.html"> |
| |
| |
| Core |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.17" data-path="jms-core-mapping.html"> |
| |
| <a href="jms-core-mapping.html"> |
| |
| |
| Mapping JMS Concepts to the Core API |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.18" data-path="using-jms.html"> |
| |
| <a href="using-jms.html"> |
| |
| |
| Using JMS |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.19" data-path="client-classpath.html"> |
| |
| <a href="client-classpath.html"> |
| |
| |
| The Client Classpath |
| |
| </a> |
| |
| |
| |
| <ul class="articles"> |
| |
| |
| <li class="chapter " data-level="1.19.1" data-path="client-classpath-jms.html"> |
| |
| <a href="client-classpath-jms.html"> |
| |
| |
| JMS |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.19.2" data-path="client-classpath-jakarta.html"> |
| |
| <a href="client-classpath-jakarta.html"> |
| |
| |
| Jakarta |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| </ul> |
| |
| </li> |
| |
| <li class="chapter " data-level="1.20" data-path="examples.html"> |
| |
| <a href="examples.html"> |
| |
| |
| Examples |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.21" data-path="wildcard-routing.html"> |
| |
| <a href="wildcard-routing.html"> |
| |
| |
| Routing Messages With Wild Cards |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.22" data-path="wildcard-syntax.html"> |
| |
| <a href="wildcard-syntax.html"> |
| |
| |
| Wildcard Syntax |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.23" data-path="filter-expressions.html"> |
| |
| <a href="filter-expressions.html"> |
| |
| |
| Filter Expressions |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.24" data-path="persistence.html"> |
| |
| <a href="persistence.html"> |
| |
| |
| Persistence |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.25" data-path="configuring-transports.html"> |
| |
| <a href="configuring-transports.html"> |
| |
| |
| Configuring Transports |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.26" data-path="config-reload.html"> |
| |
| <a href="config-reload.html"> |
| |
| |
| Configuration Reload |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.27" data-path="connection-ttl.html"> |
| |
| <a href="connection-ttl.html"> |
| |
| |
| Detecting Dead Connections |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.28" data-path="slow-consumers.html"> |
| |
| <a href="slow-consumers.html"> |
| |
| |
| Detecting Slow Consumers |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.29" data-path="network-isolation.html"> |
| |
| <a href="network-isolation.html"> |
| |
| |
| Avoiding Network Isolation |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.30" data-path="critical-analysis.html"> |
| |
| <a href="critical-analysis.html"> |
| |
| |
| Detecting Broker Issues (Critical Analysis) |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.31" data-path="transaction-config.html"> |
| |
| <a href="transaction-config.html"> |
| |
| |
| Resource Manager Configuration |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.32" data-path="flow-control.html"> |
| |
| <a href="flow-control.html"> |
| |
| |
| Flow Control |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.33" data-path="send-guarantees.html"> |
| |
| <a href="send-guarantees.html"> |
| |
| |
| Guarantees of sends and commits |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.34" data-path="undelivered-messages.html"> |
| |
| <a href="undelivered-messages.html"> |
| |
| |
| Message Redelivery and Undelivered Messages |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.35" data-path="message-expiry.html"> |
| |
| <a href="message-expiry.html"> |
| |
| |
| Message Expiry |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.36" data-path="large-messages.html"> |
| |
| <a href="large-messages.html"> |
| |
| |
| Large Messages |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.37" data-path="paging.html"> |
| |
| <a href="paging.html"> |
| |
| |
| Paging |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.38" data-path="scheduled-messages.html"> |
| |
| <a href="scheduled-messages.html"> |
| |
| |
| Scheduled Messages |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.39" data-path="last-value-queues.html"> |
| |
| <a href="last-value-queues.html"> |
| |
| |
| Last-Value Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.40" data-path="non-destructive-queues.html"> |
| |
| <a href="non-destructive-queues.html"> |
| |
| |
| Non-Destructive Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.41" data-path="ring-queues.html"> |
| |
| <a href="ring-queues.html"> |
| |
| |
| Ring Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.42" data-path="retroactive-addresses.html"> |
| |
| <a href="retroactive-addresses.html"> |
| |
| |
| Retroactive Addresses |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.43" data-path="exclusive-queues.html"> |
| |
| <a href="exclusive-queues.html"> |
| |
| |
| Exclusive Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.44" data-path="message-grouping.html"> |
| |
| <a href="message-grouping.html"> |
| |
| |
| Message Grouping |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.45" data-path="consumer-priority.html"> |
| |
| <a href="consumer-priority.html"> |
| |
| |
| Consumer Priority |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.46" data-path="pre-acknowledge.html"> |
| |
| <a href="pre-acknowledge.html"> |
| |
| |
| Extra Acknowledge Modes |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.47" data-path="management.html"> |
| |
| <a href="management.html"> |
| |
| |
| Management |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.48" data-path="management-console.html"> |
| |
| <a href="management-console.html"> |
| |
| |
| Management Console |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.49" data-path="metrics.html"> |
| |
| <a href="metrics.html"> |
| |
| |
| Metrics |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.50" data-path="security.html"> |
| |
| <a href="security.html"> |
| |
| |
| Security |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.51" data-path="masking-passwords.html"> |
| |
| <a href="masking-passwords.html"> |
| |
| |
| Masking Passwords |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.52" data-path="broker-plugins.html"> |
| |
| <a href="broker-plugins.html"> |
| |
| |
| Broker Plugins |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.53" data-path="resource-limits.html"> |
| |
| <a href="resource-limits.html"> |
| |
| |
| Resource Limits |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.54" data-path="jms-bridge.html"> |
| |
| <a href="jms-bridge.html"> |
| |
| |
| The JMS Bridge |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter active" data-level="1.55" data-path="client-failover.html"> |
| |
| <a href="client-failover.html"> |
| |
| |
| Client Failover |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.56" data-path="diverts.html"> |
| |
| <a href="diverts.html"> |
| |
| |
| Diverting and Splitting Message Flows |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.57" data-path="core-bridges.html"> |
| |
| <a href="core-bridges.html"> |
| |
| |
| Core Bridges |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.58" data-path="transformers.html"> |
| |
| <a href="transformers.html"> |
| |
| |
| Transformers |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.59" data-path="duplicate-detection.html"> |
| |
| <a href="duplicate-detection.html"> |
| |
| |
| Duplicate Message Detection |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.60" data-path="clusters.html"> |
| |
| <a href="clusters.html"> |
| |
| |
| Clusters |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.61" data-path="federation.html"> |
| |
| <a href="federation.html"> |
| |
| |
| Federation |
| |
| </a> |
| |
| |
| |
| <ul class="articles"> |
| |
| |
| <li class="chapter " data-level="1.61.1" data-path="federation-address.html"> |
| |
| <a href="federation-address.html"> |
| |
| |
| Address Federation |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.61.2" data-path="federation-queue.html"> |
| |
| <a href="federation-queue.html"> |
| |
| |
| Queue Federation |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| </ul> |
| |
| </li> |
| |
| <li class="chapter " data-level="1.62" data-path="ha.html"> |
| |
| <a href="ha.html"> |
| |
| |
| High Availability and Failover |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.63" data-path="connection-routers.html"> |
| |
| <a href="connection-routers.html"> |
| |
| |
| Connection Routers |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.64" data-path="graceful-shutdown.html"> |
| |
| <a href="graceful-shutdown.html"> |
| |
| |
| Graceful Server Shutdown |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.65" data-path="libaio.html"> |
| |
| <a href="libaio.html"> |
| |
| |
| Libaio Native Libraries |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.66" data-path="thread-pooling.html"> |
| |
| <a href="thread-pooling.html"> |
| |
| |
| Thread management |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.67" data-path="web-server.html"> |
| |
| <a href="web-server.html"> |
| |
| |
| Embedded Web Server |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.68" data-path="logging.html"> |
| |
| <a href="logging.html"> |
| |
| |
| Logging |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.69" data-path="embedding-activemq.html"> |
| |
| <a href="embedding-activemq.html"> |
| |
| |
| Embedding the Broker |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.70" data-path="karaf.html"> |
| |
| <a href="karaf.html"> |
| |
| |
| Apache Karaf |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.71" data-path="tomcat.html"> |
| |
| <a href="tomcat.html"> |
| |
| |
| Apache Tomcat |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.72" data-path="spring-integration.html"> |
| |
| <a href="spring-integration.html"> |
| |
| |
| Spring Integration |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.73" data-path="cdi-integration.html"> |
| |
| <a href="cdi-integration.html"> |
| |
| |
| CDI Integration |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.74" data-path="intercepting-operations.html"> |
| |
| <a href="intercepting-operations.html"> |
| |
| |
| Intercepting Operations |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.75" data-path="data-tools.html"> |
| |
| <a href="data-tools.html"> |
| |
| |
| Data Tools |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.76" data-path="activation-tools.html"> |
| |
| <a href="activation-tools.html"> |
| |
| |
| Activation Tools |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.77" data-path="maven-plugin.html"> |
| |
| <a href="maven-plugin.html"> |
| |
| |
| Maven Plugin |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.78" data-path="unit-testing.html"> |
| |
| <a href="unit-testing.html"> |
| |
| |
| Unit Testing |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.79" data-path="perf-tuning.html"> |
| |
| <a href="perf-tuning.html"> |
| |
| |
| Troubleshooting and Performance Tuning |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.80" data-path="perf-tools.html"> |
| |
| <a href="perf-tools.html"> |
| |
| |
| Performance Tools |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.81" data-path="configuration-index.html"> |
| |
| <a href="configuration-index.html"> |
| |
| |
| Configuration Reference |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.82" data-path="restart-sequence.html"> |
| |
| <a href="restart-sequence.html"> |
| |
| |
| Restart Sequence |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.83" data-path="resource-adapter.html"> |
| |
| <a href="resource-adapter.html"> |
| |
| |
| Resource Adapter |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| |
| |
| <li class="divider"></li> |
| |
| <li> |
| <a href="https://github.com/honkit/honkit" target="blank" class="gitbook-link"> |
| Published with HonKit |
| </a> |
| </li> |
| </ul> |
| |
| |
| </nav> |
| |
| |
| </div> |
| |
| <div class="book-body"> |
| |
| <div class="body-inner"> |
| |
| |
| |
| <div class="book-header" role="navigation"> |
| |
| |
| <!-- Title --> |
| <h1> |
| <i class="fa fa-circle-o-notch fa-spin"></i> |
| <a href="." >Client Failover</a> |
| </h1> |
| </div> |
| |
| |
| |
| |
| <div class="page-wrapper" tabindex="-1" role="main"> |
| <div class="page-inner"> |
| |
| <div id="book-search-results"> |
| <div class="search-noresults"> |
| |
| <section class="normal markdown-section"> |
| |
| <h1 id="client-failover">Client Failover</h1> |
| <p>Apache ActiveMQ Artemis clients can be configured to automatically |
| <a href="#reconnect-to-the-same-server">reconnect to the same server</a>, |
| <a href="#reconnect-to-the-backup-server">reconnect to the backup server</a> or |
| <a href="#reconnect-to-other-live-servers">reconnect to other live servers</a> in the event |
| that a failure is detected in the connection between the client and the server. |
| The clients detect connection failure when they have not received any packets |
| from the server within the time given by <code>client-failure-check-period</code> as explained |
| in section <a href="connection-ttl.html">Detecting Dead Connections</a>.</p> |
| <h2 id="reconnect-to-the-same-server">Reconnect to the same server</h2> |
| <p>Set <code>reconnectAttempts</code> to any non-zero value to reconnect to the same server, |
| for further details see |
| <a href="#client-failover-attributes">Reconnection and failover attributes</a>.</p> |
| <p>If the disconnection was due to some transient failure such as a temporary |
| network outage and the target server was not restarted, then the sessions will |
| still exist on the server, assuming the client hasn't been disconnected for |
| more than <a href="connection-ttl.html">connection-ttl</a></p> |
| <p>In this scenario, the client sessions will be automatically re-attached to the |
| server sessions after the reconnection. This is done 100% transparently and the |
| client can continue exactly as if nothing had happened.</p> |
| <p>The way this works is as follows:</p> |
| <p>As Apache ActiveMQ Artemis clients send commands to their servers they store |
| each sent command in an in-memory buffer. In the case that connection failure |
| occurs and the client subsequently reattaches to the same server, as part of |
| the reattachment protocol the server informs the client during reattachment |
| with the id of the last command it successfully received from that client.</p> |
| <p>If the client has sent more commands than were received before failover it can |
| replay any sent commands from its buffer so that the client and server can |
| reconcile their states.Ac</p> |
| <p>The size of this buffer is configured with the <code>confirmationWindowSize</code> |
| parameter on the connection URL. When the server has received |
| <code>confirmationWindowSize</code> bytes of commands and processed them it will send back |
| a command confirmation to the client, and the client can then free up space in |
| the buffer.</p> |
| <p>The window is specified in bytes.</p> |
| <p>Setting this parameter to <code>-1</code> disables any buffering and prevents any |
| re-attachment from occurring, forcing reconnect instead. The default value for |
| this parameter is <code>-1</code>. (Which means by default no auto re-attachment will |
| occur)</p> |
| <h2 id="reconnect-to-the-backup-server">Reconnect to the backup server</h2> |
| <p>Set <code>reconnectAttempts</code> to any non-zero value and <code>ha</code> to <code>true</code> to reconnect |
| to the back server, for further details see |
| <a href="#client-failover-attributes">Reconnection and failover attributes</a>.</p> |
| <p>The clients can be configured to discover the list of live-backup |
| server groups in a number of different ways. They can be configured |
| explicitly or probably the most common way of doing this is to use |
| <em>server discovery</em> for the client to automatically discover the list. |
| For full details on how to configure server discovery, please see <a href="clusters.html">Clusters</a>. |
| Alternatively, the clients can explicitly connect to a specific server |
| and download the current servers and backups see <a href="clusters.html">Clusters</a>.</p> |
| <p>By default, failover will only occur after at least one connection has |
| been made to the live server. In other words, by default, failover will |
| not occur if the client fails to make an initial connection to the live |
| server - in this case it will simply retry connecting to the live server |
| according to the reconnect-attempts property and fail after this number |
| of attempts.</p> |
| <h2 id="reconnect-to-other-live-servers">Reconnect to other live servers</h2> |
| <p>Set <code>failoverAttempts</code> to any non-zero value to reconnect to other live servers, |
| for further details see |
| <a href="#client-failover-attributes">Reconnection and failover attributes</a>.</p> |
| <p>If <code>reconnectAttempts</code> value is not zero then the client will try to reconnect |
| to other live servers only after all attempts to |
| <a href="#reconnect-to-the-same-server">reconnect to the same server</a> or |
| <a href="#reconnect-to-the-backup-server">reconnect to the backup server</a> fail.</p> |
| <h2 id="session-reconnection">Session reconnection</h2> |
| <p>When clients <a href="#reconnect-to-the-same-server">reconnect to the same server</a> |
| after a restart, <a href="#reconnect-to-the-backup-server">reconnect to the backup server</a> |
| or <a href="#reconnect-to-other-live-servers">reconnect to other live servers</a> any sessions |
| will no longer exist on the server and it won't be possible to 100% transparently |
| re-attach to them. In this case, any sessions and consumers on the client will be |
| automatically recreated on the server.</p> |
| <p>Client reconnection is also used internally by components such as core bridges |
| to allow them to reconnect to their target servers.</p> |
| <h2 id="failing-over-on-the-initial-connection">Failing over on the initial connection</h2> |
| <p>Since the client does not learn about the full topology until after the |
| first connection is made there is a window where it does not know about |
| the backup. If a failure happens at this point the client can only try |
| reconnecting to the original live server. To configure how many attempts |
| the client will make you can set the URL parameter <code>initialConnectAttempts</code>. |
| The default for this is <code>0</code>, that is try only once. Once the number of |
| attempts has been made an exception will be thrown.</p> |
| <p>For examples of automatic failover with transacted and non-transacted |
| JMS sessions, please see <a href="examples.html">the examples</a> chapter.</p> |
| <h2 id="reconnection-and-failover-attributes">Reconnection and failover attributes</h2> |
| <p>Client reconnection and failover is configured using the following parameters:</p> |
| <ul> |
| <li><p><code>retryInterval</code>. This optional parameter determines the period in |
| milliseconds between subsequent reconnection attempts, if the connection to |
| the target server has failed. The default value is <code>2000</code> milliseconds.</p> |
| </li> |
| <li><p><code>retryIntervalMultiplier</code>. This optional parameter determines a multiplier |
| to apply to the time since the last retry to compute the time to the next |
| retry.</p> |
| <p>This allows you to implement an <em>exponential backoff</em> between retry attempts.</p> |
| <p>Let's take an example:</p> |
| <p>If we set <code>retryInterval</code> to <code>1000</code> ms and we set <code>retryIntervalMultiplier</code> |
| to <code>2.0</code>, then, if the first reconnect attempt fails, we will wait <code>1000</code> ms |
| then <code>2000</code> ms then <code>4000</code> ms between subsequent reconnection attempts.</p> |
| <p>The default value is <code>1.0</code> meaning each reconnect attempt is spaced at equal |
| intervals.</p> |
| </li> |
| <li><p><code>maxRetryInterval</code>. This optional parameter determines the maximum retry |
| interval that will be used. When setting <code>retryIntervalMultiplier</code> it would |
| otherwise be possible that subsequent retries exponentially increase to |
| ridiculously large values. By setting this parameter you can set an upper limit |
| on that value. The default value is <code>2000</code> milliseconds.</p> |
| </li> |
| <li><p><code>ha</code>. This optional parameter determines weather the client will try to |
| reconnect to the backup node when the live node is not reachable. |
| The default value is <code>false</code>. |
| For more information on HA, please see <a href="ha.html">High Availability and Failover</a>.</p> |
| </li> |
| <li><p><code>reconnectAttempts</code>. This optional parameter determines the total number of |
| reconnect attempts to make to the current live/backup pair before giving up. |
| A value of <code>-1</code> signifies an unlimited number of attempts. |
| The default value is <code>0</code>.</p> |
| </li> |
| <li><p><code>failoverAttempts</code>. This optional parameter determines the total number of |
| failover attempts to make after a reconnection failure before giving up and |
| shutting down. A value of <code>-1</code> signifies an unlimited number of attempts. |
| The default value is <code>0</code>.</p> |
| </li> |
| </ul> |
| <p>All of these parameters are set on the URL used to connect to the broker.</p> |
| <p>If your client does manage to reconnect but the session is no longer available |
| on the server, for instance if the server has been restarted or it has timed |
| out, then the client won't be able to re-attach, and any <code>ExceptionListener</code> or |
| <code>FailureListener</code> instances registered on the connection or session will be |
| called.</p> |
| <h2 id="exceptionlisteners-and-sessionfailurelisteners">ExceptionListeners and SessionFailureListeners</h2> |
| <p>Please note, that when a client reconnects or re-attaches, any registered JMS |
| <code>ExceptionListener</code> or core API <code>SessionFailureListener</code> will be called.</p> |
| |
| |
| </section> |
| |
| </div> |
| <div class="search-results"> |
| <div class="has-results"> |
| |
| <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1> |
| <ul class="search-results-list"></ul> |
| |
| </div> |
| <div class="no-results"> |
| |
| <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1> |
| |
| </div> |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| |
| </div> |
| |
| |
| |
| <a href="jms-bridge.html" class="navigation navigation-prev " aria-label="Previous page: The JMS Bridge"> |
| <i class="fa fa-angle-left"></i> |
| </a> |
| |
| |
| <a href="diverts.html" class="navigation navigation-next " aria-label="Next page: Diverting and Splitting Message Flows"> |
| <i class="fa fa-angle-right"></i> |
| </a> |
| |
| |
| |
| </div> |
| |
| <script> |
| var gitbook = gitbook || []; |
| gitbook.push(function() { |
| gitbook.page.hasChanged({"page":{"title":"Client Failover","level":"1.55","depth":1,"next":{"title":"Diverting and Splitting Message Flows","level":"1.56","depth":1,"path":"diverts.md","ref":"diverts.md","articles":[]},"previous":{"title":"The JMS Bridge","level":"1.54","depth":1,"path":"jms-bridge.md","ref":"jms-bridge.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"github":"apache/activemq-artemis","theme":"default","githubHost":"https://github.com/","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56},"embedFonts":false},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"version":"2.30.0","title":"ActiveMQ Artemis Documentation","links":{"home":"http://activemq.apache.org/artemis","issues":"https://issues.apache.org/jira/browse/ARTEMIS","contribute":"http://activemq.apache.org/contributing.html"},"gitbook":"3.x.x","description":"ActiveMQ Artemis User Guide and Reference Documentation"},"file":{"path":"client-failover.md","mtime":"2023-07-26T17:45:39.751Z","type":"markdown"},"gitbook":{"version":"4.0.7","time":"2023-07-26T17:45:40.181Z"},"basePath":".","book":{"language":""}}); |
| }); |
| </script> |
| </div> |
| |
| |
| <noscript> |
| <style> |
| .honkit-cloak { |
| display: block !important; |
| } |
| </style> |
| </noscript> |
| <script> |
| // Restore sidebar state as critical path for prevent layout shift |
| function __init__getSidebarState(defaultValue){ |
| var baseKey = ""; |
| var key = baseKey + ":sidebar"; |
| try { |
| var value = localStorage[key]; |
| if (value === undefined) { |
| return defaultValue; |
| } |
| var parsed = JSON.parse(value); |
| return parsed == null ? defaultValue : parsed; |
| } catch (e) { |
| return defaultValue; |
| } |
| } |
| function __init__restoreLastSidebarState() { |
| var isMobile = window.matchMedia("(max-width: 600px)").matches; |
| if (isMobile) { |
| // Init last state if not mobile |
| return; |
| } |
| var sidebarState = __init__getSidebarState(true); |
| var book = document.querySelector(".book"); |
| // Show sidebar if it enabled |
| if (sidebarState && book) { |
| book.classList.add("without-animation", "with-summary"); |
| } |
| } |
| |
| try { |
| __init__restoreLastSidebarState(); |
| } finally { |
| var book = document.querySelector(".book"); |
| book.classList.remove("honkit-cloak"); |
| } |
| </script> |
| <script src="gitbook/gitbook.js"></script> |
| <script src="gitbook/theme.js"></script> |
| |
| |
| <script src="gitbook/gitbook-plugin-search/search-engine.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-search/search.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script> |
| |
| |
| |
| </body> |
| </html> |
| |