INT-2046 added @ManagedAttribute to MessageStores

Added to the getMessageCount() in GemfireMessageStore, MongoDbMessageStore, and RedisMessageStore.
This commit is contained in:
Mark Fisher
2011-08-11 13:59:12 -04:00
parent bce562368c
commit da2f275074
3 changed files with 7 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ import org.springframework.integration.Message;
import org.springframework.integration.MessageHeaders;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.store.MessageStore;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
@@ -89,9 +90,9 @@ public class MongoDbMessageStore implements MessageStore, BeanClassLoaderAware {
return this.template.findOne(this.idQuery(id), Message.class, this.collectionName);
}
@ManagedAttribute
public long getMessageCount() {
// TODO: long to int
return new Long(this.template.getCollection(DEFAULT_COLLECTION_NAME).getCount()).intValue();
return this.template.getCollection(DEFAULT_COLLECTION_NAME).getCount();
}
public Message<?> removeMessage(UUID id) {