6 lines
5.8 KiB
HTML
6 lines
5.8 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>5. Error Channels</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-stream-binder-rabbit.html" title="Spring Cloud Stream RabbitMQ Binder Reference Guide"><link rel="up" href="multi__reference_guide.html" title="Part I. Reference Guide"><link rel="prev" href="multi__retry_with_the_rabbitmq_binder.html" title="4. Retry With the RabbitMQ Binder"><link rel="next" href="multi_rabbit-dlq-processing.html" title="6. Dead-Letter Queue Processing"></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. Error Channels</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__retry_with_the_rabbitmq_binder.html">Prev</a> </td><th width="60%" align="center">Part I. Reference Guide</th><td width="20%" align="right"> <a accesskey="n" href="multi_rabbit-dlq-processing.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="rabbit-error-channels" href="#rabbit-error-channels"></a>5. Error Channels</h2></div></div></div><p>Starting with version 1.3, the binder unconditionally sends exceptions to an error channel for each consumer destination and can also be configured to send async producer send failures to an error channel.
|
|
See <span class="quote">“<span class="quote"><a class="xref" href="">???</a></span>”</span> for more information.</p><p>RabbitMQ has two types of send failures:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Returned messages,</li><li class="listitem">Negatively acknowledged <a class="link" href="https://www.rabbitmq.com/confirms.html" target="_top">Publisher Confirms</a>.</li></ul></div><p>The latter is rare.
|
|
According to the RabbitMQ documentation "[A nack] will only be delivered if an internal error occurs in the Erlang process responsible for a queue.".</p><p>As well as enabling producer error channels (as described in <span class="quote">“<span class="quote"><a class="xref" href="">???</a></span>”</span>), the RabbitMQ binder only sends messages to the channels if the connection factory is appropriately configured, as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">ccf.setPublisherConfirms(true);</code></li><li class="listitem"><code class="literal">ccf.setPublisherReturns(true);</code></li></ul></div><p>When using Spring Boot configuration for the connection factory, set the following properties:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">spring.rabbitmq.publisher-confirms</code></li><li class="listitem"><code class="literal">spring.rabbitmq.publisher-returns</code></li></ul></div><p>The payload of the <code class="literal">ErrorMessage</code> for a returned message is a <code class="literal">ReturnedAmqpMessageException</code> with the following properties:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">failedMessage</code>: The spring-messaging <code class="literal">Message<?></code> that failed to be sent.</li><li class="listitem"><code class="literal">amqpMessage</code>: The raw spring-amqp <code class="literal">Message</code>.</li><li class="listitem"><code class="literal">replyCode</code>: An integer value indicating the reason for the failure (for example, 312 - No route).</li><li class="listitem"><code class="literal">replyText</code>: A text value indicating the reason for the failure (for example, <code class="literal">NO_ROUTE</code>).</li><li class="listitem"><code class="literal">exchange</code>: The exchange to which the message was published.</li><li class="listitem"><code class="literal">routingKey</code>: The routing key used when the message was published.</li></ul></div><p>For negatively acknowledged confirmations, the payload is a <code class="literal">NackedAmqpMessageException</code> with the following properties:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">failedMessage</code>: The spring-messaging <code class="literal">Message<?></code> that failed to be sent.</li><li class="listitem"><code class="literal">nackReason</code>: A reason (if available — you may need to examine the broker logs for more information).</li></ul></div><p>There is no automatic handling of these exceptions (such as sending to a <a class="link" href="multi_rabbit-dlq-processing.html" title="6. Dead-Letter Queue Processing">dead-letter queue</a>).
|
|
You can consume these exceptions with your own Spring Integration flow.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__retry_with_the_rabbitmq_binder.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="multi__reference_guide.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="multi_rabbit-dlq-processing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4. Retry With the RabbitMQ Binder </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-stream-binder-rabbit.html">Home</a></td><td width="40%" align="right" valign="top"> 6. Dead-Letter Queue Processing</td></tr></table></div></body></html> |