INT-2622: add JMX support for DelayerHandler

* introduce DelayHandlerManagement
* add GroovyControlBusIntegrationTests
* test for Delayer Management via Groovy Control Bus
This commit is contained in:
Artem Bilan
2012-06-20 12:42:40 +03:00
committed by Gary Russell
parent 0a6e44ddc5
commit e5061c070b
6 changed files with 156 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ import org.springframework.integration.store.MessageGroupStore;
import org.springframework.integration.store.MessageStore;
import org.springframework.integration.store.SimpleMessageStore;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.Assert;
@@ -62,7 +63,9 @@ import org.springframework.util.Assert;
* @author Artem Bilan
* @since 1.0.3
*/
public class DelayHandler extends AbstractReplyProducingMessageHandler implements ApplicationListener<ContextRefreshedEvent> {
@ManagedResource
public class DelayHandler extends AbstractReplyProducingMessageHandler implements DelayHandlerManagement, ApplicationListener<ContextRefreshedEvent> {
private final String messageGroupId;
@@ -226,6 +229,10 @@ public class DelayHandler extends AbstractReplyProducingMessageHandler implement
}
}
public int getDelayedMessageCount() {
return this.messageStore.messageGroupSize(this.messageGroupId);
}
/**
* Used for reading persisted Messages in the 'messageStore'
* to reschedule them e.g. upon application restart.

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2002-2012 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.integration.handler;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
/**
* @author Artem Bilan
* @since 2.2
*/
public interface DelayHandlerManagement {
@ManagedAttribute
int getDelayedMessageCount();
@ManagedOperation
void reschedulePersistedMessages();
}