camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/6] camel git commit: CAMEL-8147: Camel JMX when using custom @ManagedResource should mixin the standard mbean operations/attributes so you get both worlds.
Date Tue, 11 Aug 2015 13:23:07 GMT
CAMEL-8147: Camel JMX when using custom @ManagedResource should mixin the standard mbean operations/attributes
so you get both worlds.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c35c0e94
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c35c0e94
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c35c0e94

Branch: refs/heads/master
Commit: c35c0e948ad35b65ab846b3ef73083d69c15a7d1
Parents: f28399f
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Aug 11 14:33:09 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Aug 11 15:30:40 2015 +0200

----------------------------------------------------------------------
 .../component/disruptor/DisruptorEndpoint.java  | 43 +++++---------------
 .../apache/camel/component/jms/JmsEndpoint.java | 29 -------------
 .../jms/JmsEndpointConfigurationTest.java       |  4 +-
 .../component/jms/ManagedJmsEndpointTest.java   |  3 ++
 4 files changed, 15 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c35c0e94/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorEndpoint.java
b/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorEndpoint.java
index ef83f41..33debc7 100644
--- a/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorEndpoint.java
+++ b/components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorEndpoint.java
@@ -85,31 +85,6 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         this.blockWhenFull = blockWhenFull;
     }
 
-    @ManagedAttribute(description = "Camel ID")
-    public String getCamelId() {
-        return getCamelContext().getName();
-    }
-
-    @ManagedAttribute(description = "Camel ManagementName")
-    public String getCamelManagementName() {
-        return getCamelContext().getManagementName();
-    }
-
-    @ManagedAttribute(description = "Endpoint Uri", mask = true)
-    public String getEndpointUri() {
-        return super.getEndpointUri();
-    }
-
-    @ManagedAttribute(description = "Service State")
-    public String getState() {
-        ServiceStatus status = this.getStatus();
-        // if no status exists then its stopped
-        if (status == null) {
-            status = ServiceStatus.Stopped;
-        }
-        return status.name();
-    }
-
     @ManagedAttribute(description = "Queue name")
     public String getName() {
         return name;
@@ -138,6 +113,7 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         return concurrentConsumers;
     }
 
+    @ManagedAttribute(description = "Option to specify whether the caller should wait for
the async task to complete or not before continuing")
     public WaitForTaskToComplete getWaitForTaskToComplete() {
         return waitForTaskToComplete;
     }
@@ -151,7 +127,7 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         this.waitForTaskToComplete = waitForTaskToComplete;
     }
 
-    @ManagedAttribute
+    @ManagedAttribute(description = "Timeout (in milliseconds) before a producer will stop
waiting for an asynchronous task to complete")
     public long getTimeout() {
         return timeout;
     }
@@ -164,13 +140,18 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         this.timeout = timeout;
     }
 
+    @Override
+    @ManagedAttribute(description = "Specifies whether multiple consumers are allowed")
+    public boolean isMultipleConsumersSupported() {
+        return isMultipleConsumers();
+    }
+
     /**
      * Specifies whether multiple consumers are allowed.
      * If enabled, you can use Disruptor for Publish-Subscribe messaging.
      * That is, you can send a message to the queue and have each consumer receive a copy
of the message.
      * When enabled, this option should be specified on every consumer endpoint.
      */
-    @ManagedAttribute
     public boolean isMultipleConsumers() {
         return multipleConsumers;
     }
@@ -189,12 +170,6 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         return Collections.unmodifiableSet(producers);
     }
 
-    @Override
-    @ManagedAttribute
-    public boolean isMultipleConsumersSupported() {
-        return isMultipleConsumers();
-    }
-
     @ManagedAttribute
     public boolean isBlockWhenFull() {
         return blockWhenFull;
@@ -209,6 +184,7 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         this.blockWhenFull = blockWhenFull;
     }
 
+    @ManagedAttribute(description = "Defines the strategy used by consumer threads to wait
on new exchanges to be published")
     public DisruptorWaitStrategy getWaitStrategy() {
         return waitStrategy;
     }
@@ -221,6 +197,7 @@ public class DisruptorEndpoint extends DefaultEndpoint implements MultipleConsum
         this.waitStrategy = waitStrategy;
     }
 
+    @ManagedAttribute(description = " Defines the producers allowed on the Disruptor")
     public DisruptorProducerType getProducerType() {
         return producerType;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c35c0e94/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
index 3edbbd1..aa7f530 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
@@ -38,11 +38,9 @@ import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.Service;
-import org.apache.camel.ServiceStatus;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.SynchronousDelegateProducer;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
@@ -418,7 +416,6 @@ public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
         this.selector = selector;
     }
 
-    @ManagedAttribute
     public boolean isSingleton() {
         return true;
     }
@@ -1217,32 +1214,6 @@ public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
         configuration.setReplyToType(type);
     }
 
-    @ManagedAttribute(description = "Camel ID")
-    public String getCamelId() {
-        return getCamelContext().getName();
-    }
-
-    @ManagedAttribute(description = "Camel ManagementName")
-    public String getCamelManagementName() {
-        return getCamelContext().getManagementName();
-    }
-
-    @ManagedAttribute(description = "Endpoint Uri", mask = true)
-    @Override
-    public String getEndpointUri() {
-        return super.getEndpointUri();
-    }
-
-    @ManagedAttribute(description = "Service State")
-    public String getState() {
-        ServiceStatus status = this.getStatus();
-        // if no status exists then its stopped
-        if (status == null) {
-            status = ServiceStatus.Stopped;
-        }
-        return status.name();
-    }
-
     @ManagedAttribute(description = "Number of running message listeners")
     public int getRunningMessageListeners() {
         return runningMessageListeners.get();

http://git-wip-us.apache.org/repos/asf/camel/blob/c35c0e94/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
index 744979e..e4d0d7b 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
@@ -275,7 +275,7 @@ public class JmsEndpointConfigurationTest extends CamelTestSupport {
         assertNull(endpoint.getAcknowledgementModeName());
         assertEquals(-1, endpoint.getCacheLevel());
         assertNull(endpoint.getCacheLevelName());
-        assertNotNull(endpoint.getCamelId());
+        assertNotNull(endpoint.getCamelContext().getName());
         assertNull(endpoint.getClientId());
         assertNotNull(endpoint.getConnectionFactory());
         assertEquals(1, endpoint.getConcurrentConsumers());
@@ -310,7 +310,7 @@ public class JmsEndpointConfigurationTest extends CamelTestSupport {
         assertEquals(1000L, endpoint.getRequestTimeoutCheckerInterval());
         assertEquals(0, endpoint.getRunningMessageListeners());
         assertNull(endpoint.getSelector());
-        assertEquals(ServiceStatus.Started.toString(), endpoint.getState());
+        assertEquals(ServiceStatus.Started.toString(), endpoint.getStatus());
         assertEquals(-1, endpoint.getTimeToLive());
         assertNull(endpoint.getTransactionName());
         assertEquals(-1, endpoint.getTransactionTimeout());

http://git-wip-us.apache.org/repos/asf/camel/blob/c35c0e94/components/camel-jms/src/test/java/org/apache/camel/component/jms/ManagedJmsEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ManagedJmsEndpointTest.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ManagedJmsEndpointTest.java
index c06e620..0ce6cff 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ManagedJmsEndpointTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ManagedJmsEndpointTest.java
@@ -83,6 +83,9 @@ public class ManagedJmsEndpointTest extends CamelTestSupport {
 
         size = (Long) mbeanServer.invoke(name, "queueSize", null, null);
         assertEquals(1, size.intValue());
+
+        String body = (String) mbeanServer.invoke(name, "browseMessageBody", new Object[]{0},
new String[]{"java.lang.Integer"});
+        assertEquals("Hi World", body);
     }
 
     @Override


Mime
View raw message