Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
XD-2719: Add Rabbit Bus Cleanup REST Method
Browse files Browse the repository at this point in the history
JIRA: https://jira.spring.io/browse/XD-2719

curl 'http://localhost:9393/streams/clean/rabbit/foo\
     ?user=guest&pw=guest&vhost=/&busPrefix=xdbus.&adminUri=http://localhost:15672'

Query params are optional (defaults as shown).

Looks for queues named xdbus.<stream>.0, 1, 2, 3 etc and possibly their associated
.dlq companions.

Verifies that none of the queues are currently in use (but does not check if they are empty.

If no queues have consumers, all that were found are deleted.

XD-2719: Remove Fanout Exchanges for Taps

XD-2719: Clean Up Jobs

Remove job queue event tap exchanges.

    curl -X DELETE localhost:9393/jobs/clean/rabbit/jobxxx
  • Loading branch information
garyrussell authored and Eric Bottard committed Feb 26, 2015
1 parent 61060d1 commit 2d5f3f7
Show file tree
Hide file tree
Showing 32 changed files with 965 additions and 45 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Expand Up @@ -378,6 +378,7 @@ project('spring-xd-dirt') {
compile "org.springframework.cloud:spring-cloud-cloudfoundry-connector"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-actuator"
compile "org.springframework:spring-web"
compile("org.springframework.boot:spring-boot-starter-security") {
exclude group: 'org.springframework.boot', module: "spring-boot-starter-logging"
}
Expand Down Expand Up @@ -1086,6 +1087,7 @@ project('spring-xd-test') {
compile "org.springframework:spring-context"
compile "org.springframework:spring-context-support"
compile "org.springframework:spring-tx"
compile "org.springframework:spring-web"
compile "org.springframework:spring-test"
compile "org.springframework.data:spring-data-hadoop-test"
compile "redis.clients:jedis"
Expand Down
@@ -0,0 +1,39 @@
/*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.xd.dirt.integration.bus;

import java.util.List;
import java.util.Map;


/**
* Interface for implementations that perform cleanup for message buses.
*
* @author Gary Russell
* @since 1.2
*/
public interface BusCleaner {

/**
* Clean up all resources for the supplied stream/job.
* @param entity the stream or job.
* @param isJob true if the entity is a job.
* @return a map of lists of resources removed.
*/
Map<String, List<String>> clean(String entity, boolean isJob);

}
@@ -0,0 +1,33 @@
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.xd.dirt.integration.bus.rabbit;


/**
* Thrown when a delete operation has nothing to delete.
*
* @author Gary Russell
* @since 1.2
*/
@SuppressWarnings("serial")
public class NothingToDeleteException extends RabbitAdminException {

public NothingToDeleteException(String message) {
super(message);
}

}
@@ -0,0 +1,39 @@
/*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.xd.dirt.integration.bus.rabbit;

import org.springframework.xd.dirt.XDRuntimeException;


/**
* Exceptions thrown while interfacing with the RabbitMQ admin plugin.
*
* @author Gary Russell
* @since 1.2
*/
@SuppressWarnings("serial")
public class RabbitAdminException extends XDRuntimeException {

public RabbitAdminException(String message, Throwable cause) {
super(message, cause);
}

public RabbitAdminException(String message) {
super(message);
}

}

0 comments on commit 2d5f3f7

Please sign in to comment.