INT-2823 Add QueueChannelOperations
Operations on QueueChannel (clear, getQueueSize etc) are not available when the IntegrationMBeanExporter is configured because they are not declared on the PollableChannel interface. Add an additional interface QueueChannelOperations. The proxy proxies all interfaces so users can cast the proxy to QueueChannelOperations to use its methods.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -23,11 +23,14 @@ import javax.management.ObjectName;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.channel.QueueChannelOperations;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@@ -36,7 +39,10 @@ public class PriorityChannelTests {
|
||||
|
||||
@Autowired
|
||||
private MBeanServer server;
|
||||
|
||||
|
||||
@Autowired
|
||||
private PollableChannel testChannel;
|
||||
|
||||
@Test
|
||||
public void testHandlerMBeanRegistration() throws Exception {
|
||||
Set<ObjectName> names = server.queryNames(new ObjectName("test.PriorityChannel:type=MessageHandler,*"), null);
|
||||
@@ -49,6 +55,7 @@ public class PriorityChannelTests {
|
||||
Set<ObjectName> names = server.queryNames(new ObjectName("test.PriorityChannel:type=MessageChannel,name=testChannel,*"), null);
|
||||
assertEquals(1, names.size());
|
||||
assertEquals(0, server.getAttribute(names.iterator().next(), "QueueSize"));
|
||||
assertEquals(0, ((QueueChannelOperations) testChannel).getQueueSize());
|
||||
}
|
||||
|
||||
public static class Source {
|
||||
|
||||
Reference in New Issue
Block a user