2020-07-15 02:39:08 +08:00
|
|
|
%% This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
2010-01-28 00:01:54 +08:00
|
|
|
%%
|
2024-01-23 12:44:47 +08:00
|
|
|
%% Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
2010-01-28 00:01:54 +08:00
|
|
|
%%
|
|
|
|
|
|
2025-08-26 01:37:49 +08:00
|
|
|
-define(SHOVEL_APP, rabbitmq_shovel).
|
|
|
|
|
|
2010-01-28 00:01:54 +08:00
|
|
|
-record(endpoint,
|
2013-11-29 21:53:37 +08:00
|
|
|
{uris,
|
2013-11-21 21:10:54 +08:00
|
|
|
resource_declaration
|
2010-01-28 00:01:54 +08:00
|
|
|
}).
|
|
|
|
|
|
|
|
|
|
-record(shovel,
|
|
|
|
|
{sources,
|
|
|
|
|
destinations,
|
2010-02-26 02:19:11 +08:00
|
|
|
prefetch_count,
|
2011-06-29 18:59:55 +08:00
|
|
|
ack_mode,
|
Implemented the publish_fields thing, which then means that exchange shouldn't exist in the destinations, which also then means that I should pull out queue to the main body. So eg this now works:
[{rabbit_shovel,
[{shovels,
[{my_first_shovel,
[{sources, [{brokers, ["amqp://guest:guest@localhost/"]},
{declarations, [{'queue.declare',[]},
{'exchange.declare',[{exchange, <<"my_exchange">>},
{type, <<"fanout">>},
durable]},
{'queue.bind',[{exchange, <<"my_exchange">>},
{queue, <<>>}]}
]}]},
{destinations, [{broker, "amqp://"}]},
{qos, 10},
{queue, <<>>},
{auto_ack, false},
{tx_size, 0},
{delivery_mode, keep},
{publish_fields, [{exchange, <<"my_exchange">>}]},
{reconnect, 5}
]}
]
}]
}].
In publish_fields, you can (obviously) set anything, including routing_key (which by default is set to the received routing key). Note that delivery_mode is in P_basic, not basic.publish, which is why it's separate.
2010-01-29 22:52:33 +08:00
|
|
|
publish_fields,
|
2010-02-17 23:56:59 +08:00
|
|
|
publish_properties,
|
Implemented the publish_fields thing, which then means that exchange shouldn't exist in the destinations, which also then means that I should pull out queue to the main body. So eg this now works:
[{rabbit_shovel,
[{shovels,
[{my_first_shovel,
[{sources, [{brokers, ["amqp://guest:guest@localhost/"]},
{declarations, [{'queue.declare',[]},
{'exchange.declare',[{exchange, <<"my_exchange">>},
{type, <<"fanout">>},
durable]},
{'queue.bind',[{exchange, <<"my_exchange">>},
{queue, <<>>}]}
]}]},
{destinations, [{broker, "amqp://"}]},
{qos, 10},
{queue, <<>>},
{auto_ack, false},
{tx_size, 0},
{delivery_mode, keep},
{publish_fields, [{exchange, <<"my_exchange">>}]},
{reconnect, 5}
]}
]
}]
}].
In publish_fields, you can (obviously) set anything, including routing_key (which by default is set to the received routing key). Note that delivery_mode is in P_basic, not basic.publish, which is why it's separate.
2010-01-29 22:52:33 +08:00
|
|
|
queue,
|
2014-03-01 00:58:32 +08:00
|
|
|
reconnect_delay,
|
|
|
|
|
delete_after = never
|
2010-01-28 00:01:54 +08:00
|
|
|
}).
|
2017-01-12 23:06:41 +08:00
|
|
|
|
|
|
|
|
-define(SHOVEL_USER, <<"rmq-shovel">>).
|
2025-08-28 05:26:07 +08:00
|
|
|
-define(SHOVEL_COMPONENT, <<"shovel">>).
|
2017-01-25 23:03:30 +08:00
|
|
|
-define(DEFAULT_PREFETCH, 1000).
|
|
|
|
|
-define(DEFAULT_ACK_MODE, on_confirm).
|
|
|
|
|
-define(DEFAULT_RECONNECT_DELAY, 5).
|
2019-03-27 00:32:19 +08:00
|
|
|
|
2024-03-08 04:53:14 +08:00
|
|
|
-define(SHOVEL_GUIDE_URL, <<"https://rabbitmq.com/docs/shovel">>).
|