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
Copy file name to clipboardExpand all lines: docs/docs/reactive-commons/9-configuration-properties.md
+35-51Lines changed: 35 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -274,60 +274,46 @@ public AsyncKafkaPropsDomain.KafkaSecretFiller customKafkaFiller() {
274
274
</TabItem>
275
275
</Tabs>
276
276
277
-
## Propiedad mandatoy en RabbitMQ
278
-
La propiedad mandatory es un parámetro de publicación de mensajes en RabbitMQ que determina el comportamiento cuando un
279
-
mensaje no puede ser enrutado a ninguna cola. Esto puede ocurrir si no hay colas enlazadas al exchange o si la clave de
280
-
enrutamiento no coincide con ninguna de las colas disponibles.
277
+
## Mandatory property in RabbitMQ
278
+
The mandatory property is a message publishing parameter in RabbitMQ that determines the behavior when a message cannot be routed to any queue. This can happen if there are no queues bound to the exchange or if the routing key does not match any of the available queues.
281
279
282
-
Por defecto, esta opción está desactivada, pero si se activa (`mandatory = true`) funciona justo después de que el
283
-
mensaje es publicado en un exchange, pero antes de que se enrute a una cola.
280
+
By default, this option is disabled, but if activated (`mandatory = true`), it works right after the message is published to an exchange, but before it is routed to a queue.
284
281
285
-
Cuando se publica un mensaje con `mandatory = true`, RabbitMQ intentará enrutarlo desde el exchange hacia una o más
286
-
colas. Si ninguna cola recibe el mensaje, entonces:
282
+
When a message is published with `mandatory = true`, RabbitMQ will try to route it from the exchange to one or more queues. If no queue receives the message, then:
287
283
288
-
- El mensaje no se pierde, pero no se entrega a ninguna cola.
289
-
- RabbitMQ activa un evento basic.return en el canal del productor.
290
-
- El productor debe tener un ReturnListener o un manejador equivalente para recibir y procesar el mensaje devuelto. Si
291
-
no se define uno el mensaje se pierde.
284
+
- The message is not lost, but it is not delivered to any queue.
285
+
- RabbitMQ triggers a basic.return event on the producer's channel.
286
+
- The producer must have a ReturnListener or an equivalent handler to receive and process the returned message. If one is not defined, the message is lost.
292
287
293
-
#### Ejemplo
288
+
#### Example
294
289
295
-
Suponiendo que tenemos:
290
+
Assuming we have:
296
291
297
-
- Un exchange tipo direct.
298
-
- Una cola enlazada con la clave `orden.creada`.
299
-
- Se publica un mensaje con clave `orden.cancelada` y `mandatory = true`.
292
+
- A direct type exchange.
293
+
- A queue bound with the key `order.created`.
294
+
- A message is published with the key `order.cancelled` and `mandatory = true`.
300
295
301
-
Resultado:
296
+
Result:
302
297
303
-
- Si no hay ninguna cola enlazada con `orden.cancelada`, el mensaje no se enruta.
304
-
- Como `mandatory = true`, RabbitMQ intenta devolverlo al productor.
305
-
- Si se tiene un ReturnListener, se puede capturar y manejar ese mensaje, por ejemplo enviarlo a una cola de otro
306
-
consumidor, colas DLQ, guardarlo en un archivo logs o en una base de datos.
298
+
- If there is no queue bound with `order.cancelled`, the message is not routed.
299
+
- Since `mandatory = true`, RabbitMQ tries to return it to the producer.
300
+
- If there is a ReturnListener, this message can be captured and handled, for example, by sending it to another consumer's queue, DLQ queues, saving it in a log file, or in a database.
307
301
308
-
### Ventajas
302
+
### Advantages
309
303
310
-
- Detección temprana de errores de enrutamiento: Evita que mensajes críticos “desaparezcan” sin rastro lo que facilita
311
-
la identificación de configuraciones erróneas en bindings o patrones.
312
-
- Integridad y fiabilidad: Garantiza que cada mensaje encuentre un consumidor o, en su defecto, regrese al productor
313
-
para un manejo alternativo (colas DLQ, logs, base de datos).
314
-
- Visibilidad operacional: Facilita métricas de “mensajes no enrutados” y alertas cuando el flujo de eventos no cumple
315
-
las rutas previstas.
304
+
- Early detection of routing errors: Prevents critical messages from "disappearing" without a trace, which facilitates the identification of erroneous configurations in bindings or patterns.
305
+
- Integrity and reliability: Ensures that each message finds a consumer or, failing that, returns to the producer for alternative handling (DLQ queues, logs, database).
306
+
- Operational visibility: Facilitates metrics of "unrouted messages" and alerts when the event flow does not follow the planned routes.
316
307
317
-
### Consideraciones
308
+
### Considerations
318
309
319
-
Aunque esta propiedad no evita problemas de rendimiento o degradación del clúster RabbitMQ, sí es útil para evitar la
320
-
pérdida de mensajes no enrutados y para detectar errores de configuración en el enrutamiento.
310
+
Although this property does not prevent performance problems or degradation of the RabbitMQ cluster, it is useful for preventing the loss of unrouted messages and for detecting configuration errors in routing.
321
311
322
-
Cuando mandatory está activo, en condiciones normales (todas las rutas existen) no hay prácticamente impacto. En
323
-
situaciones anómalas, habrá un tráfico adicional de retorno por cada mensaje no enrutable. Esto supone carga extra
324
-
tanto para RabbitMQ (que debe enviar de vuelta el mensaje al productor) como para la aplicación emisora (que debe
325
-
procesar el mensaje devuelto).
312
+
When mandatory is active, under normal conditions (all routes exist), there is practically no impact. In anomalous situations, there will be additional return traffic for each unroutable message. This implies an extra load for both RabbitMQ (which must send the message back to the producer) and the sending application (which must process the returned message).
326
313
327
-
### Implementación
314
+
### Implementation
328
315
329
-
Para habilitar la propiedad `mandatory` en Reactive Commons, puedes configurarla en el archivo `application.yaml` de tu
330
-
proyecto:
316
+
To enable the `mandatory` property in Reactive Commons, you can configure it in your project's `application.yaml` file:
331
317
332
318
```yaml
333
319
app:
@@ -336,10 +322,8 @@ app:
336
322
mandatory: true # enable mandatory property
337
323
```
338
324
339
-
Ahora configuramos el handler de retorno para manejar los mensajes que no pudieron ser entregados correctamente, por
340
-
defecto estos mensajes se muestran en un log.
341
-
Para personalizar este comportamiento se crea una clase que implemente la interfaz `UnroutableMessageHandler` y se
342
-
registra como un bean de Spring:
325
+
Now we configure the return handler to manage messages that could not be delivered correctly. By default, these messages are displayed in a log.
326
+
To customize this behavior, a class that implements the `UnroutableMessageHandler` interface is created and registered as a Spring bean:
343
327
344
328
```java
345
329
package sample;
@@ -377,15 +361,15 @@ public class ResendUnroutableMessageHandler implements UnroutableMessageHandler
377
361
}
378
362
```
379
363
380
-
#### Enviar mensajes no enrutados a una cola
364
+
#### Send unrouted messages to a queue
381
365
382
-
Para enviar el mensaje no enrutado a una cola, utilizamos las anotaciones `@EnableDomainEventBus` para
383
-
[eventos de dominio](/reactive-commons-java/docs/reactive-commons/sending-a-domain-event), y `@EnableDirectAsyncGateway`
384
-
para [comandos](/reactive-commons-java/docs/reactive-commons/sending-a-command) y
385
-
[consultas asíncronas](/reactive-commons-java/docs/reactive-commons/making-an-async-query), según corresponda.
366
+
To send the unrouted message to a queue, we use the `@EnableDomainEventBus` annotations for
367
+
[domain events](/reactive-commons-java/docs/reactive-commons/sending-a-domain-event), and `@EnableDirectAsyncGateway`
368
+
for [commands](/reactive-commons-java/docs/reactive-commons/sending-a-command) and
369
+
[asynchronous queries](/reactive-commons-java/docs/reactive-commons/making-an-async-query), as appropriate.
386
370
387
-
Es importante asegurarse de que la cola exista antes de enviar el mensaje, ya que, de lo contrario, este se perderá.
388
-
Por lo tanto, se recomienda verificar o crear la cola previamente para garantizar una entrega exitosa.
371
+
It is important to ensure that the queue exists before sending the message, as it will otherwise be lost.
372
+
Therefore, it is recommended to verify or create the queue beforehand to ensure successful delivery.
389
373
390
374
```java
391
375
package sample;
@@ -449,7 +433,7 @@ public class ResendUnroutableMessageHandler implements UnroutableMessageHandler
449
433
}
450
434
```
451
435
452
-
En la clase de configuración de RabbitMQ creamos el bean `UnroutableMessageProcessor` para registrar el handler de mensajes no enrutados.
436
+
In the RabbitMQ configuration class, we create the `UnroutableMessageProcessor` bean to register the unrouted message handler.
0 commit comments