Sync docs from master to gh-pages

This commit is contained in:
buildmaster
2017-11-28 16:32:58 +00:00
parent 20f9a178da
commit 1aaadd9c58
8 changed files with 28 additions and 13 deletions

View File

@@ -1,3 +1,3 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>3.&nbsp;Addressing all instances of a service</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__addressing_an_instance.html" title="2.&nbsp;Addressing an Instance"><link rel="next" href="multi__application_context_id_must_be_unique.html" title="4.&nbsp;Application Context ID must be unique"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.&nbsp;Addressing all instances of a service</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__addressing_an_instance.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__application_context_id_must_be_unique.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_all_instances_of_a_service" href="#_addressing_all_instances_of_a_service"></a>3.&nbsp;Addressing all instances of a service</h1></div></div></div><p>The "destination" parameter is used in a Spring <code class="literal">PathMatcher</code> (with the path separator as a colon <code class="literal">:</code>) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the profiles and ports set as the <code class="literal">ApplicationContext</code> ID.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__addressing_an_instance.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__application_context_id_must_be_unique.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.&nbsp;Addressing an Instance&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;4.&nbsp;Application Context ID must be unique</td></tr></table></div></body></html>
<title>3.&nbsp;Addressing all instances of a service</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__addressing_an_instance.html" title="2.&nbsp;Addressing an Instance"><link rel="next" href="multi__service_id_must_be_unique.html" title="4.&nbsp;Service ID must be unique"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.&nbsp;Addressing all instances of a service</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__addressing_an_instance.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__service_id_must_be_unique.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_all_instances_of_a_service" href="#_addressing_all_instances_of_a_service"></a>3.&nbsp;Addressing all instances of a service</h1></div></div></div><p>The "destination" parameter is used in a Spring <code class="literal">PathMatcher</code> (with the path separator as a colon <code class="literal">:</code>) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the rest of the service ID.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__addressing_an_instance.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__service_id_must_be_unique.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.&nbsp;Addressing an Instance&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;4.&nbsp;Service ID must be unique</td></tr></table></div></body></html>

View File

@@ -1,3 +1,3 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>2.&nbsp;Addressing an Instance</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__quick_start.html" title="1.&nbsp;Quick Start"><link rel="next" href="multi__addressing_all_instances_of_a_service.html" title="3.&nbsp;Addressing all instances of a service"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.&nbsp;Addressing an Instance</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__quick_start.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__addressing_all_instances_of_a_service.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_an_instance" href="#_addressing_an_instance"></a>2.&nbsp;Addressing an Instance</h1></div></div></div><p>The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is an <code class="literal">ApplicationContext</code> ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it. Spring Boot sets the ID for you in the <code class="literal">ContextIdApplicationContextInitializer</code> to a combination of the <code class="literal">spring.application.name</code>, active profiles and <code class="literal">server.port</code> by default.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__quick_start.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__addressing_all_instances_of_a_service.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">1.&nbsp;Quick Start&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;3.&nbsp;Addressing all instances of a service</td></tr></table></div></body></html>
<title>2.&nbsp;Addressing an Instance</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__quick_start.html" title="1.&nbsp;Quick Start"><link rel="next" href="multi__addressing_all_instances_of_a_service.html" title="3.&nbsp;Addressing all instances of a service"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.&nbsp;Addressing an Instance</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__quick_start.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__addressing_all_instances_of_a_service.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_an_instance" href="#_addressing_an_instance"></a>2.&nbsp;Addressing an Instance</h1></div></div></div><p>Each instance of the application has a service ID, whose value can be set using <code class="literal">spring.cloud.bus.id</code>, and whose value is expected to be a colon-separated list of identifiers, in order of least specific to most specific. The default value is constructed from the environment as a combination of the <code class="literal">spring.application.name</code> and <code class="literal">server.port</code> (or <code class="literal">spring.application.index</code> if set). The default value of the ID is constructed in the form <code class="literal">app:index:id</code> where:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">app</code> is the <code class="literal">vcap.application.name</code> if it exists, or <code class="literal">spring.application.name</code></li><li class="listitem"><code class="literal">index</code> is the <code class="literal">vcap.application.instance_index</code> if it exists, or else <code class="literal">spring.application.index</code>, or else <code class="literal">local.server.port</code> (or <code class="literal">server.port</code> or <code class="literal">0</code>).</li><li class="listitem"><code class="literal">id</code> is the <code class="literal">vcap.application.instance_id</code> if it exists, or else a random value.</li></ul></div><p>The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is a service ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__quick_start.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__addressing_all_instances_of_a_service.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">1.&nbsp;Quick Start&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;3.&nbsp;Addressing all instances of a service</td></tr></table></div></body></html>

View File

@@ -1,6 +1,6 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>5.&nbsp;Customizing the Message Broker</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__application_context_id_must_be_unique.html" title="4.&nbsp;Application Context ID must be unique"><link rel="next" href="multi__tracing_bus_events.html" title="6.&nbsp;Tracing Bus Events"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.&nbsp;Customizing the Message Broker</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__application_context_id_must_be_unique.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__tracing_bus_events.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_customizing_the_message_broker" href="#_customizing_the_message_broker"></a>5.&nbsp;Customizing the Message Broker</h1></div></div></div><p>Spring Cloud Bus uses
<title>5.&nbsp;Customizing the Message Broker</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__service_id_must_be_unique.html" title="4.&nbsp;Service ID must be unique"><link rel="next" href="multi__tracing_bus_events.html" title="6.&nbsp;Tracing Bus Events"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.&nbsp;Customizing the Message Broker</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__service_id_must_be_unique.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__tracing_bus_events.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_customizing_the_message_broker" href="#_customizing_the_message_broker"></a>5.&nbsp;Customizing the Message Broker</h1></div></div></div><p>Spring Cloud Bus uses
<a class="link" href="https://cloud.spring.io/spring-cloud-stream" target="_top">Spring Cloud Stream</a> to
broadcast the messages so to get messages to flow you only need to
include the binder implementation of your choice in the
@@ -14,4 +14,4 @@ configuration properties. Spring Cloud Bus has a handful of native
configuration properties in <code class="literal">spring.cloud.bus.*</code>
(e.g. <code class="literal">spring.cloud.bus.destination</code> is the name of the topic to use
the the externall middleware). Normally the defaults will suffice.</p><p>To lean more about how to customize the message broker settings
consult the Spring Cloud Stream documentation.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__application_context_id_must_be_unique.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__tracing_bus_events.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.&nbsp;Application Context ID must be unique&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;6.&nbsp;Tracing Bus Events</td></tr></table></div></body></html>
consult the Spring Cloud Stream documentation.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__service_id_must_be_unique.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__tracing_bus_events.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.&nbsp;Service ID must be unique&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;6.&nbsp;Tracing Bus Events</td></tr></table></div></body></html>

View File

@@ -0,0 +1,3 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>4.&nbsp;Service ID must be unique</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="up" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="prev" href="multi__addressing_all_instances_of_a_service.html" title="3.&nbsp;Addressing all instances of a service"><link rel="next" href="multi__customizing_the_message_broker.html" title="5.&nbsp;Customizing the Message Broker"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.&nbsp;Service ID must be unique</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__addressing_all_instances_of_a_service.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__customizing_the_message_broker.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_service_id_must_be_unique" href="#_service_id_must_be_unique"></a>4.&nbsp;Service ID must be unique</h1></div></div></div><p>The bus tries to eliminate processing an event twice, once from the original <code class="literal">ApplicationEvent</code> and once from the queue. To do this, it checks the sending service ID againts the current service ID. If multiple instances of a service have the same ID, events will not be processed. Running on a local machine, each service will be on a different port and that will be part of the ID. Cloud Foundry supplies an index to differentiate. To ensure that the ID is unique outside Cloud Foundry, set <code class="literal">spring.application.index</code> to something unique for each instance of a service.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__addressing_all_instances_of_a_service.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__customizing_the_message_broker.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.&nbsp;Addressing all instances of a service&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-bus.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;5.&nbsp;Customizing the Message Broker</td></tr></table></div></body></html>

View File

@@ -1,3 +1,3 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring Cloud Bus</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="next" href="multi_pr01.html" title=""></head><body class="firstpage" bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Spring Cloud Bus</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi_pr01.html">Next</a></td></tr></table><hr></div><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Bus</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="multi_pr01.html"></a></span></dt><dt><span class="chapter"><a href="multi__quick_start.html">1. Quick Start</a></span></dt><dt><span class="chapter"><a href="multi__addressing_an_instance.html">2. Addressing an Instance</a></span></dt><dt><span class="chapter"><a href="multi__addressing_all_instances_of_a_service.html">3. Addressing all instances of a service</a></span></dt><dt><span class="chapter"><a href="multi__application_context_id_must_be_unique.html">4. Application Context ID must be unique</a></span></dt><dt><span class="chapter"><a href="multi__customizing_the_message_broker.html">5. Customizing the Message Broker</a></span></dt><dt><span class="chapter"><a href="multi__tracing_bus_events.html">6. Tracing Bus Events</a></span></dt><dt><span class="chapter"><a href="multi__broadcasting_your_own_events.html">7. Broadcasting Your Own Events</a></span></dt><dd><dl><dt><span class="section"><a href="multi__broadcasting_your_own_events.html#_registering_events_in_custom_packages">7.1. Registering events in custom packages</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi_pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>
<title>Spring Cloud Bus</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-bus.html" title="Spring Cloud Bus"><link rel="next" href="multi_pr01.html" title=""></head><body class="firstpage" bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Spring Cloud Bus</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi_pr01.html">Next</a></td></tr></table><hr></div><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Bus</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="multi_pr01.html"></a></span></dt><dt><span class="chapter"><a href="multi__quick_start.html">1. Quick Start</a></span></dt><dt><span class="chapter"><a href="multi__addressing_an_instance.html">2. Addressing an Instance</a></span></dt><dt><span class="chapter"><a href="multi__addressing_all_instances_of_a_service.html">3. Addressing all instances of a service</a></span></dt><dt><span class="chapter"><a href="multi__service_id_must_be_unique.html">4. Service ID must be unique</a></span></dt><dt><span class="chapter"><a href="multi__customizing_the_message_broker.html">5. Customizing the Message Broker</a></span></dt><dt><span class="chapter"><a href="multi__tracing_bus_events.html">6. Tracing Bus Events</a></span></dt><dt><span class="chapter"><a href="multi__broadcasting_your_own_events.html">7. Broadcasting Your Own Events</a></span></dt><dd><dl><dt><span class="section"><a href="multi__broadcasting_your_own_events.html#_registering_events_in_custom_packages">7.1. Registering events in custom packages</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi_pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>

View File

@@ -1,13 +1,13 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring Cloud Bus</title><link rel="stylesheet" type="text/css" href="css/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Bus</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="#d0e9"></a></span></dt><dt><span class="chapter"><a href="#_quick_start">1. Quick Start</a></span></dt><dt><span class="chapter"><a href="#_addressing_an_instance">2. Addressing an Instance</a></span></dt><dt><span class="chapter"><a href="#_addressing_all_instances_of_a_service">3. Addressing all instances of a service</a></span></dt><dt><span class="chapter"><a href="#_application_context_id_must_be_unique">4. Application Context ID must be unique</a></span></dt><dt><span class="chapter"><a href="#_customizing_the_message_broker">5. Customizing the Message Broker</a></span></dt><dt><span class="chapter"><a href="#_tracing_bus_events">6. Tracing Bus Events</a></span></dt><dt><span class="chapter"><a href="#_broadcasting_your_own_events">7. Broadcasting Your Own Events</a></span></dt><dd><dl><dt><span class="section"><a href="#_registering_events_in_custom_packages">7.1. Registering events in custom packages</a></span></dt></dl></dd></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p>Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions. A key idea is that the Bus is like a distributed Actuator for a Spring Boot application that is scaled out, but it can also be used as a communication channel between apps. Starters are provided for an AMQP broker as the transport or for Kafka, but the same basic feature set (and some more depending on the transport) is on the roadmap for other transports.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at <a class="link" href="https://github.com/spring-cloud/spring-cloud-config/tree/master/docs/src/main/asciidoc" target="_top">github</a>.</p></td></tr></table></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_quick_start" href="#_quick_start"></a>1.&nbsp;Quick Start</h1></div></div></div><p>Spring Cloud Bus works by adding Spring Boot autconfiguration if it detects itself on the classpath. All you need to do to enable the bus is to add <code class="literal">spring-cloud-starter-bus-amqp</code> or <code class="literal">spring-cloud-starter-bus-kafka</code> to your dependency management and Spring Cloud takes care of the rest. Make sure the broker (RabbitMQ or Kafka) is available and configured: running on localhost you shouldn&#8217;t have to do anything, but if you are running remotely use Spring Cloud Connectors, or Spring Boot conventions to define the broker credentials, e.g. for Rabbit</p><p><b>application.yml.&nbsp;</b>
<title>Spring Cloud Bus</title><link rel="stylesheet" type="text/css" href="css/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Bus</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="#d0e9"></a></span></dt><dt><span class="chapter"><a href="#_quick_start">1. Quick Start</a></span></dt><dt><span class="chapter"><a href="#_addressing_an_instance">2. Addressing an Instance</a></span></dt><dt><span class="chapter"><a href="#_addressing_all_instances_of_a_service">3. Addressing all instances of a service</a></span></dt><dt><span class="chapter"><a href="#_service_id_must_be_unique">4. Service ID must be unique</a></span></dt><dt><span class="chapter"><a href="#_customizing_the_message_broker">5. Customizing the Message Broker</a></span></dt><dt><span class="chapter"><a href="#_tracing_bus_events">6. Tracing Bus Events</a></span></dt><dt><span class="chapter"><a href="#_broadcasting_your_own_events">7. Broadcasting Your Own Events</a></span></dt><dd><dl><dt><span class="section"><a href="#_registering_events_in_custom_packages">7.1. Registering events in custom packages</a></span></dt></dl></dd></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p>Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions. A key idea is that the Bus is like a distributed Actuator for a Spring Boot application that is scaled out, but it can also be used as a communication channel between apps. Starters are provided for an AMQP broker as the transport or for Kafka, but the same basic feature set (and some more depending on the transport) is on the roadmap for other transports.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at <a class="link" href="https://github.com/spring-cloud/spring-cloud-config/tree/master/docs/src/main/asciidoc" target="_top">github</a>.</p></td></tr></table></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_quick_start" href="#_quick_start"></a>1.&nbsp;Quick Start</h1></div></div></div><p>Spring Cloud Bus works by adding Spring Boot autconfiguration if it detects itself on the classpath. All you need to do to enable the bus is to add <code class="literal">spring-cloud-starter-bus-amqp</code> or <code class="literal">spring-cloud-starter-bus-kafka</code> to your dependency management and Spring Cloud takes care of the rest. Make sure the broker (RabbitMQ or Kafka) is available and configured: running on localhost you shouldn&#8217;t have to do anything, but if you are running remotely use Spring Cloud Connectors, or Spring Boot conventions to define the broker credentials, e.g. for Rabbit</p><p><b>application.yml.&nbsp;</b>
</p><pre class="screen">spring:
rabbitmq:
host: mybroker.com
port: 5672
username: user
password: secret</pre><p>
</p><p>The bus currently supports sending messages to all nodes listening or all nodes for a particular service (as defined by Eureka). More selector criteria may be added in the future (ie. only service X nodes in data center Y, etc&#8230;&#8203;). There are also some http endpoints under the <code class="literal">/bus/*</code> actuator namespace. There are currently two implemented. The first, <code class="literal">/bus/env</code>, sends key/value pairs to update each node&#8217;s Spring Environment. The second, <code class="literal">/bus/refresh</code>, will reload each application&#8217;s configuration, just as if they had all been pinged on their <code class="literal">/refresh</code> endpoint.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The Bus starters cover Rabbit and Kafka, because those are the two most common implementations, but Spring Cloud Stream is quite flexible and binder will work combined with <code class="literal">spring-cloud-bus</code>.</p></td></tr></table></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_an_instance" href="#_addressing_an_instance"></a>2.&nbsp;Addressing an Instance</h1></div></div></div><p>The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is an <code class="literal">ApplicationContext</code> ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it. Spring Boot sets the ID for you in the <code class="literal">ContextIdApplicationContextInitializer</code> to a combination of the <code class="literal">spring.application.name</code>, active profiles and <code class="literal">server.port</code> by default.</p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_all_instances_of_a_service" href="#_addressing_all_instances_of_a_service"></a>3.&nbsp;Addressing all instances of a service</h1></div></div></div><p>The "destination" parameter is used in a Spring <code class="literal">PathMatcher</code> (with the path separator as a colon <code class="literal">:</code>) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the profiles and ports set as the <code class="literal">ApplicationContext</code> ID.</p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_application_context_id_must_be_unique" href="#_application_context_id_must_be_unique"></a>4.&nbsp;Application Context ID must be unique</h1></div></div></div><p>The bus tries to eliminate processing an event twice, once from the original <code class="literal">ApplicationEvent</code> and once from the queue. To do this, it checks the sending application context id againts the current application context id. If multiple instances of a service have the same application context id, events will not be processed. Running on a local machine, each service will be on a different port and that will be part of the application context id. Cloud Foundry supplies an index to differentiate. To ensure that the application context id is the unique, set <code class="literal">spring.application.index</code> to something unique for each instance of a service. For example, in lattice, set <code class="literal">spring.application.index=${INSTANCE_INDEX}</code> in application.properties (or bootstrap.properties if using configserver).</p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_customizing_the_message_broker" href="#_customizing_the_message_broker"></a>5.&nbsp;Customizing the Message Broker</h1></div></div></div><p>Spring Cloud Bus uses
</p><p>The bus currently supports sending messages to all nodes listening or all nodes for a particular service (as defined by Eureka). More selector criteria may be added in the future (ie. only service X nodes in data center Y, etc&#8230;&#8203;). There are also some http endpoints under the <code class="literal">/bus/*</code> actuator namespace. There are currently two implemented. The first, <code class="literal">/bus/env</code>, sends key/value pairs to update each node&#8217;s Spring Environment. The second, <code class="literal">/bus/refresh</code>, will reload each application&#8217;s configuration, just as if they had all been pinged on their <code class="literal">/refresh</code> endpoint.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The Bus starters cover Rabbit and Kafka, because those are the two most common implementations, but Spring Cloud Stream is quite flexible and binder will work combined with <code class="literal">spring-cloud-bus</code>.</p></td></tr></table></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_an_instance" href="#_addressing_an_instance"></a>2.&nbsp;Addressing an Instance</h1></div></div></div><p>Each instance of the application has a service ID, whose value can be set using <code class="literal">spring.cloud.bus.id</code>, and whose value is expected to be a colon-separated list of identifiers, in order of least specific to most specific. The default value is constructed from the environment as a combination of the <code class="literal">spring.application.name</code> and <code class="literal">server.port</code> (or <code class="literal">spring.application.index</code> if set). The default value of the ID is constructed in the form <code class="literal">app:index:id</code> where:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">app</code> is the <code class="literal">vcap.application.name</code> if it exists, or <code class="literal">spring.application.name</code></li><li class="listitem"><code class="literal">index</code> is the <code class="literal">vcap.application.instance_index</code> if it exists, or else <code class="literal">spring.application.index</code>, or else <code class="literal">local.server.port</code> (or <code class="literal">server.port</code> or <code class="literal">0</code>).</li><li class="listitem"><code class="literal">id</code> is the <code class="literal">vcap.application.instance_id</code> if it exists, or else a random value.</li></ul></div><p>The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is a service ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it.</p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_addressing_all_instances_of_a_service" href="#_addressing_all_instances_of_a_service"></a>3.&nbsp;Addressing all instances of a service</h1></div></div></div><p>The "destination" parameter is used in a Spring <code class="literal">PathMatcher</code> (with the path separator as a colon <code class="literal">:</code>) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the rest of the service ID.</p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_service_id_must_be_unique" href="#_service_id_must_be_unique"></a>4.&nbsp;Service ID must be unique</h1></div></div></div><p>The bus tries to eliminate processing an event twice, once from the original <code class="literal">ApplicationEvent</code> and once from the queue. To do this, it checks the sending service ID againts the current service ID. If multiple instances of a service have the same ID, events will not be processed. Running on a local machine, each service will be on a different port and that will be part of the ID. Cloud Foundry supplies an index to differentiate. To ensure that the ID is unique outside Cloud Foundry, set <code class="literal">spring.application.index</code> to something unique for each instance of a service.</p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_customizing_the_message_broker" href="#_customizing_the_message_broker"></a>5.&nbsp;Customizing the Message Broker</h1></div></div></div><p>Spring Cloud Bus uses
<a class="link" href="https://cloud.spring.io/spring-cloud-stream" target="_top">Spring Cloud Stream</a> to
broadcast the messages so to get messages to flow you only need to
include the binder implementation of your choice in the

View File

@@ -90,7 +90,7 @@ $(addBlockSwitches);
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>1.3.3.BUILD-SNAPSHOT</p>
<p>2.0.0.BUILD-SNAPSHOT</p>
</div>
</div>
</div>

View File

@@ -34,15 +34,27 @@
</chapter>
<chapter xml:id="_addressing_an_instance">
<title>Addressing an Instance</title>
<simpara>The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is an <literal>ApplicationContext</literal> ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it. Spring Boot sets the ID for you in the <literal>ContextIdApplicationContextInitializer</literal> to a combination of the <literal>spring.application.name</literal>, active profiles and <literal>server.port</literal> by default.</simpara>
<simpara>Each instance of the application has a service ID, whose value can be set using <literal>spring.cloud.bus.id</literal>, and whose value is expected to be a colon-separated list of identifiers, in order of least specific to most specific. The default value is constructed from the environment as a combination of the <literal>spring.application.name</literal> and <literal>server.port</literal> (or <literal>spring.application.index</literal> if set). The default value of the ID is constructed in the form <literal>app:index:id</literal> where:</simpara>
<itemizedlist>
<listitem>
<simpara><literal>app</literal> is the <literal>vcap.application.name</literal> if it exists, or <literal>spring.application.name</literal></simpara>
</listitem>
<listitem>
<simpara><literal>index</literal> is the <literal>vcap.application.instance_index</literal> if it exists, or else <literal>spring.application.index</literal>, or else <literal>local.server.port</literal> (or <literal>server.port</literal> or <literal>0</literal>).</simpara>
</listitem>
<listitem>
<simpara><literal>id</literal> is the <literal>vcap.application.instance_id</literal> if it exists, or else a random value.</simpara>
</listitem>
</itemizedlist>
<simpara>The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is a service ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it.</simpara>
</chapter>
<chapter xml:id="_addressing_all_instances_of_a_service">
<title>Addressing all instances of a service</title>
<simpara>The "destination" parameter is used in a Spring <literal>PathMatcher</literal> (with the path separator as a colon <literal>:</literal>) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the profiles and ports set as the <literal>ApplicationContext</literal> ID.</simpara>
<simpara>The "destination" parameter is used in a Spring <literal>PathMatcher</literal> (with the path separator as a colon <literal>:</literal>) to determine if an instance will process the message. Using the example from above, "/bus/refresh?destination=customers:**" will target all instances of the "customers" service regardless of the rest of the service ID.</simpara>
</chapter>
<chapter xml:id="_application_context_id_must_be_unique">
<title>Application Context ID must be unique</title>
<simpara>The bus tries to eliminate processing an event twice, once from the original <literal>ApplicationEvent</literal> and once from the queue. To do this, it checks the sending application context id againts the current application context id. If multiple instances of a service have the same application context id, events will not be processed. Running on a local machine, each service will be on a different port and that will be part of the application context id. Cloud Foundry supplies an index to differentiate. To ensure that the application context id is the unique, set <literal>spring.application.index</literal> to something unique for each instance of a service. For example, in lattice, set <literal>spring.application.index=${INSTANCE_INDEX}</literal> in application.properties (or bootstrap.properties if using configserver).</simpara>
<chapter xml:id="_service_id_must_be_unique">
<title>Service ID must be unique</title>
<simpara>The bus tries to eliminate processing an event twice, once from the original <literal>ApplicationEvent</literal> and once from the queue. To do this, it checks the sending service ID againts the current service ID. If multiple instances of a service have the same ID, events will not be processed. Running on a local machine, each service will be on a different port and that will be part of the ID. Cloud Foundry supplies an index to differentiate. To ensure that the ID is unique outside Cloud Foundry, set <literal>spring.application.index</literal> to something unique for each instance of a service.</simpara>
</chapter>
<chapter xml:id="_customizing_the_message_broker">
<title>Customizing the Message Broker</title>