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
An optional list of AMQP 0-9-1 operations to be executed by the Shovel
386
+
before it starts transferring messages. They are typically used to set
387
+
up the topology.
388
+
</p>
389
+
```erlang
390
+
{declarations, [
391
+
%% declaration list
392
+
]}
393
+
```
394
+
<p>
395
+
The declarations follow method and property names used by the <a href="/client-libraries/erlang-client-user-guide">RabbitMQ Erlang Client</a>.
396
+
</p>
397
+
<p>
398
+
A minimalistic declaration example:
399
+
</p>
400
+
```erlang
401
+
{declarations, [
402
+
'queue.declare',
403
+
{'queue.bind', [
404
+
{exchange, <<"my_exchange">>},
405
+
{queue, <<>>}
406
+
]}
407
+
]}
408
+
```
409
+
<p>
410
+
will first declare an anonymous queue, and then bind it
411
+
to the exchange called <code>"my_exchange"</code>. The
412
+
queue name of <code><<>></code> on method <code>queue.bind</code>
413
+
means "use the queue last declared on this channel".
414
+
</p>
415
+
<p>
416
+
Each element of the declaration list is either an AMQP 0-9-1 method
417
+
given as single quoted atom such as <code>'queue.declare'</code>,
418
+
or a tuple with first element the method atom, and second element
419
+
a property list of parameters.
420
+
</p>
421
+
<p>
422
+
If just the method name is used all the
423
+
parameters take their defaults (as illustrated with
424
+
<code>'queue.declare'</code> above).
425
+
</p>
426
+
<p>
427
+
If a tuple and property-list is supplied, then the
428
+
properties in the list specify some or all of the
429
+
parameters explicitly.
430
+
</p>
431
+
<p>
432
+
Here is another example:
433
+
</p>
434
+
```erlang
435
+
{'exchange.declare', [
436
+
{exchange, <<"my_exchange">>},
437
+
{type, <<"direct">>},
438
+
durable
439
+
]}
440
+
```
441
+
<p>
442
+
will declare a durable, direct exchange called
443
+
"<code>my_exchange</code>".
444
+
</p>
445
+
</td>
446
+
</tr>
447
+
448
+
<tr>
449
+
<td>queue</td>
450
+
<td>
451
+
<p>
452
+
The name of the source queue as an Erlang binary value. This property is mandatory:
453
+
454
+
```erlang
455
+
{queue, <<"queue.1">>}
456
+
```
457
+
</p>
458
+
<p>
459
+
<code>queue.1</code> is the name of the queue
460
+
to shovel messages from, as a binary string.
461
+
</p>
462
+
<p>
463
+
This queue must exist. Use the resource <code>declarations</code>
464
+
covered above to declare the queue or ensure it exists. If
465
+
the value is <code><<>></code> (the empty binary string) then the
466
+
<em>most recently declared queue</em> in <code>declarations</code> is used.
467
+
This allows anonymous queues to be declared and used.
468
+
469
+
See also [Predeclared topology section](#predeclared-topology) below.
470
+
</p>
471
+
</td>
472
+
</tr>
473
+
474
+
<tr>
475
+
<td>prefetch-count</td>
476
+
<td>
477
+
The maximum number of unacknowledged messages copied over a shovel at
478
+
any one time. Default is <code>1000</code>:
479
+
480
+
```erlang
481
+
{prefetch_count, 1000}
482
+
```
483
+
</td>
484
+
</tr>
485
+
</tbody>
486
+
</table>
487
+
488
+
#### Predeclared Topology {#predeclared-topology}
489
+
490
+
The `declarations` attribute is typically used to set up the topology. At the very least, it must set up the source queue.
491
+
492
+
There are deployment scenarios where the topology is automatically [imported from a definitions file at boot time](./definitions#import-on-boot). In these scenarios, we can configure the plugin to wait until the queue is available by adding the following line to the `rabbitmq.conf` file:
493
+
```ini
494
+
shovel.topology.predeclared = true
495
+
```
496
+
497
+
With the above configuration, if a static shovel has no `declarations` attribute or it is empty, the piugin will wait until the source's `queue` is eventually declared.
498
+
366
499
## Destination
367
500
368
501
`destination` is a mandatory key and has different keys properties
369
502
for different protocols. Two properties are common across all
370
503
protocols: `protocol` and `uris`.
371
-
`protocol` supports two values: `amqp091`and `amqp10`,
372
-
for AMQP 0-9-1 and AMQP 1.0, respectively:
504
+
`protocol` supports three values: `amqp091`, `amqp10`and `local`
505
+
for AMQP 0-9-1, AMQP 1.0 and local shovels, respectively:
373
506
374
507
```erlang
375
508
%% for AMQP 0-9-1
@@ -639,6 +772,47 @@ are available to static shovels, such as TLS certificate and private key.
This boolean key controls whether a custom header, <code>x-opt-shovelled-timestamp</code>,
792
+
will be added to the message before it is re-published:
793
+
794
+
```erlang
795
+
{add_timestamp_header, true}
796
+
```
797
+
798
+
This header value is timestamp (in seconds since epoch) when message had been shovelled.
799
+
By default the header is not added.
800
+
</td>
801
+
</tr>
802
+
803
+
<tr>
804
+
<td>add_forward_headers</td>
805
+
<td>
806
+
When set to true the shovel will add a number of custom message headers: <code>x-opt-shovelled-by</code>, <code>x-opt-shovel-type</code>, <code>x-opt-shovel-name</code>,
807
+
to provide some additional metadata about the transfer.
0 commit comments