-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add example for shovel
- Loading branch information
Showing
7 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Shovel Example | ||
|
||
Shovel can move messages between move messages reliably and continually (typically between queues). | ||
In this example, we will declare a dynamic Shovel that moves messages from a classic queue to a quorum queue in the same RabbitmqCluster. | ||
The example can be used when you want to migrate from classic or mirrored queues to quorum queues. | ||
|
||
Before creating any topology objects with Messaging Topology Operator, please deploy a RabbitmqCluster named `example-rabbit`, or any name you see fit. You will need to enable the `rabbitmq_shovel` plugin and here is an example from the [cluster operator repo](https://github.com/rabbitmq/cluster-operator/blob/main/docs/examples/plugins/rabbitmq.yaml) about enabling additional plugins. | ||
|
||
After the RabbitMQ cluster is successfully created, you need to get username and password of the default user for this RabbitMQ cluster: | ||
|
||
```bash | ||
kubectl get secret example-rabbit-default-user -o jsonpath='{.data.username}' | base64 --decode | ||
kubectl get secret example-rabbit-user -o jsonpath='{.data.password}' | base64 --decode | ||
``` | ||
Save the username and password, because we need both later to construct the source and destination URI. | ||
|
||
This example includes (please create in order): | ||
|
||
1. two vhosts: 'source' and 'destination' | ||
1. a Kubernetes secret 'shovel-secret' containing the shovel source and destination URIs | ||
1. a classic queue 'source-queue' in vhost 'source' vhost | ||
1. a quorum queue 'destination-queue' in vhost 'destination' | ||
1. shovel 'shovel-example' between queue 'source-queue' and queue 'destination-queue' | ||
|
||
After all topology objects are created, messages in 'source queue' | ||
will be moved into 'destination-queue'. | ||
|
||
Learn [more about RabbitMQ Dynamic Shovel](https://www.rabbitmq.com/shovel-dynamic.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
apiVersion: rabbitmq.com/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: source-queue | ||
namespace: rabbitmq-system | ||
spec: | ||
name: source-queue | ||
vhost: "source" | ||
autoDelete: false | ||
durable: true | ||
rabbitmqClusterReference: | ||
name: example-rabbit | ||
--- | ||
apiVersion: rabbitmq.com/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: destination-queue | ||
namespace: rabbitmq-system | ||
spec: | ||
name: destination-queue | ||
vhost: "destination" | ||
type: quoum | ||
autoDelete: false | ||
durable: true | ||
rabbitmqClusterReference: | ||
name: example-rabbit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: shovel-secret | ||
type: Opaque | ||
data: | ||
destUri: # encoded value for shovel destination URI; to learn about how to construct a valid uri, see: https://www.rabbitmq.com/uri-spec.html | ||
srcUri: # encoded value shove source URI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# for more information, see: https://www.rabbitmq.com/shovel-dynamic.html | ||
--- | ||
apiVersion: rabbitmq.com/v1beta1 | ||
kind: Shovel | ||
metadata: | ||
name: shovel-example | ||
namespace: rabbitmq-system | ||
spec: | ||
name: "shovel-example" | ||
uriSecret: | ||
name: shovel-secret | ||
srcQueue: "source-queue" | ||
destQueue: "destination-queue" | ||
rabbitmqClusterReference: | ||
name: example-rabbit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
apiVersion: rabbitmq.com/v1beta1 | ||
kind: Vhost | ||
metadata: | ||
name: source-vhost | ||
namespace: rabbitmq-system | ||
spec: | ||
name: source | ||
rabbitmqClusterReference: | ||
name: example-rabbit | ||
--- | ||
apiVersion: rabbitmq.com/v1beta1 | ||
kind: Vhost | ||
metadata: | ||
name: destination-vhost | ||
namespace: rabbitmq-system | ||
spec: | ||
name: destination | ||
rabbitmqClusterReference: | ||
name: example-rabbit |