You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
except the protocol must be `rabbitmq-stream`. <<enabling-tls,TLS is enabled>> by using
53
-
the `rabbitmq-stream+tls` scheme in the URI.
52
+
except the protocol must be `rabbitmq-stream`.
53
+
<<enabling-tls,TLS is enabled>> by using the `rabbitmq-stream+tls` scheme in the URI.
54
54
55
55
When using one URI, the corresponding node will be the main entry point to connect to. The
56
56
`Environment` will then use the stream protocol to find out more about streams topology
57
-
(leaders and replicas) when asked to create `Producer` and `Consumer` instances. The `Environment`
58
-
may become blind if this node goes down though, so it may be more appropriate to specify
59
-
several other URIs to try in case of failure of a node:
57
+
(leaders and replicas) when asked to create `Producer` and `Consumer` instances.
58
+
The `Environment` may become blind if this node goes down though, so it may be more appropriate to specify several other URIs to try in case of failure of a node:
60
59
61
60
.Creating an environment with several URIs
62
61
[source,java,indent=0]
@@ -75,7 +74,8 @@ Creating the environment to connect to a cluster node works usually seamlessly.
75
74
Creating publishers and consumers can cause problems as the client uses hints from the cluster to find the nodes where stream leaders and replicas are located to connect to the appropriate nodes.
76
75
77
76
These connection hints can be accurate or less appropriate depending on the infrastructure.
78
-
If you hit some connection problems at some point – like hostnames impossible to resolve for client applications - this https://www.rabbitmq.com/blog/2021/07/23/connecting-to-streams[blog post] should help you understand what is going on and fix the issues.
77
+
If you hit connection problems at some point – like hostnames impossible to resolve for client applications - this https://www.rabbitmq.com/blog/2021/07/23/connecting-to-streams[blog post] should help you understand what is going on and fix the issues.
78
+
Setting the `advertised_host` and `advertised_port` https://www.rabbitmq.com/blog/2021/07/23/connecting-to-streams#advertised-host-and-port[configuration entries] should solve the most common connection problems.
79
79
80
80
To make the local development experience simple, the client library can choose to always use `localhost` for producers and consumers.
81
81
This happens if the following conditions are met: the initial host to connect to is `localhost`, the user is `guest`, and no custom address resolver has been provided.
@@ -88,13 +88,10 @@ TLS can be enabled by using the `rabbitmq-stream+tls` scheme in the URI.
88
88
The default TLS port is 5551.
89
89
90
90
Use the `EnvironmentBuilder#tls` method to configure TLS.
91
-
The most important setting is a `io.netty.handler.ssl.SslContext` instance, which is created and configured with the
The most important setting is a `io.netty.handler.ssl.SslContext` instance, which is created and configured with the `io.netty.handler.ssl.SslContext#forClient` method.
93
92
Note hostname verification is enabled by default.
94
93
95
-
The following snippet shows a common configuration, whereby
96
-
the client is instructed to trust servers with certificates
97
-
signed by the configured certificate authority (CA).
94
+
The following snippet shows a common configuration, whereby the client is instructed to trust servers with certificates signed by the configured certificate authority (CA).
It is sometimes handy to trust any server certificates
110
-
in development environments. `EnvironmentBuilder#tls` provides the
111
-
`trustEverything` method to do so. **This should
112
-
not be used in a production environment**.
106
+
Checking the identity of the server the client connects to is an important part of the TLS handshake.
107
+
To make this work with the stream client library, it is critical the configured trusted certificates match the hosts returned by cluster nodes in the connection hints.
108
+
Make sure to read the section on <<understanding-connection-logic, connection logic>>.
109
+
You may have to configure the `advertised_tls_host` https://www.rabbitmq.com/blog/2021/07/23/connecting-to-streams#advertised-host-and-port[broker setting] in case of a mismatch between trusted certificates and the default connection hints cluster nodes return.
110
+
111
+
It is sometimes handy to trust any server certificates in development environments.
112
+
`EnvironmentBuilder#tls` provides the `trustEverything` method to do so.
113
+
**This should not be used in a production environment**.
113
114
114
115
.Creating a TLS environment that trusts all server certificates for development
0 commit comments