Merge pull request #5 from markfisher/INT-2046

INT-2046 added @ManagedAttribute to MessageStores
This commit is contained in:
Mark Fisher
2011-08-11 11:10:29 -07:00
3 changed files with 7 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import java.util.UUID;
import org.springframework.integration.Message;
import org.springframework.integration.store.MessageStore;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.Region;
@@ -50,6 +51,7 @@ public class GemfireMessageStore implements MessageStore {
return this.region.remove(id);
}
@ManagedAttribute
public long getMessageCount() {
return this.region.size();
}

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) {

View File

@@ -38,6 +38,7 @@ import org.springframework.integration.store.AbstractMessageGroupStore;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.store.MessageStore;
import org.springframework.integration.store.MessageStoreException;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.util.Assert;
/**
@@ -105,7 +106,7 @@ public class RedisMessageStore extends AbstractMessageGroupStore implements Mess
}
}
@ManagedAttribute
public long getMessageCount() {
return redisTemplate.execute(new RedisCallback<Integer>() {
public Integer doInRedis(RedisConnection connection)