org.usergrid.mq.cassandra
Class QueueManagerImpl

java.lang.Object
  extended by org.usergrid.mq.cassandra.QueueManagerImpl
All Implemented Interfaces:
QueueManager

public class QueueManagerImpl
extends Object
implements QueueManager


Nested Class Summary
static class QueueManagerImpl.QueueBounds
           
 
Field Summary
static int ALL_COUNT
           
static me.prettyprint.cassandra.serializers.BytesArraySerializer bae
           
static me.prettyprint.cassandra.serializers.ByteBufferSerializer be
           
static me.prettyprint.cassandra.serializers.DynamicCompositeSerializer dce
           
static int DEFAULT_SEARCH_COUNT
           
static String DICTIONARY_MESSAGE_INDEXES
           
static String DICTIONARY_SUBSCRIBER_INDEXES
           
static int INDEX_ENTRY_LIST_COUNT
           
static me.prettyprint.cassandra.serializers.LongSerializer le
           
static org.slf4j.Logger logger
           
static int QUEUE_SHARD_INTERVAL
           
static me.prettyprint.cassandra.serializers.StringSerializer se
           
static me.prettyprint.cassandra.serializers.UUIDSerializer ue
           
 
Constructor Summary
QueueManagerImpl()
           
 
Method Summary
 QueueSet addSubscribersToQueue(String publisherQueuePath, List<String> subscriberQueuePaths)
           
 Message batchPostToQueue(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, String queuePath, Message message, MessageIndexUpdate indexUpdate, long timestamp)
           
 QueueIndexUpdate batchStartQueueIndexUpdate(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, String queuePath, UUID queueId, String entryName, Object entryValue, UUID timestampUuid)
           
 void batchSubscribeToQueue(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, String publisherQueuePath, UUID publisherQueueId, String subscriberQueuePath, UUID subscriberQueueId, long timestamp)
           
 void batchUnsubscribeFromQueue(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, String publisherQueuePath, UUID publisherQueueId, String subscriberQueuePath, UUID subscriberQueueId, long timestamp)
           
 QueueIndexUpdate batchUpdateQueueIndex(QueueIndexUpdate indexUpdate, UUID subcriptionQueueId)
           
 void batchUpdateQueuePropertiesIndexes(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, String subscriberQueuePath, UUID subscriberQueueId, Map<String,Object> properties, UUID timestampUuid)
           
 void batchUpdateQueuePropertiesIndexes(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, UUID publisherQueueId, String subscriberQueuePath, UUID subscriberQueueId, Map<String,Object> properties, UUID timestampUuid)
           
 List<AggregateCounterSet> getAggregateCounters(UUID queueId, CounterQuery query)
           
 AggregateCounterSet getAggregateCounters(UUID queueId, String category, String counterName, CounterResolution resolution, long start, long finish, boolean pad)
           
 Results getAggregateQueueCounters(String queuePath, CounterQuery query)
           
 Results getAggregateQueueCounters(String queuePath, String category, String counterName, CounterResolution resolution, long start, long finish, boolean pad)
           
 QueueSet getChildQueues(String publisherQueuePath, String firstQueuePath, int count)
           
 UUID getConsumerQueuePosition(me.prettyprint.hector.api.Keyspace ko, UUID consumerId, UUID queueId)
           
 QueueResults getFromQueue(String queuePath, QueueQuery query)
           
 Message getMessage(UUID messageId)
           
 UUID getNewClient(UUID applicationId)
           
 UUID getNewConsumerId()
           
 Queue getQueue(String queuePath)
           
 Queue getQueue(String queuePath, UUID queueId)
           
 QueueManagerImpl.QueueBounds getQueueBounds(me.prettyprint.hector.api.Keyspace ko, UUID queueId)
           
 Set<String> getQueueCounterNames(String queuePath)
           
 Map<String,Long> getQueueCounters(String queuePath)
           
 Map<String,Long> getQueueCounters(UUID queueId)
           
 TreeSet<UUID> getQueueRange(me.prettyprint.hector.api.Keyspace ko, UUID queueId, QueueManagerImpl.QueueBounds bounds, TreeSet<UUID> uuid_set, UUID start_uuid, UUID finish_uuid, boolean reversed, int limit)
           
 QueueSet getQueues(String firstQueuePath, int limit)
           
 QueueSet getSubscribers(String publisherQueuePath, String firstSubscriberQueuePath, int limit)
           
 QueueSet getSubscriptions(String subscriberQueuePath, String firstSubscriptionQueuePath, int limit)
           
 void incrementAggregateQueueCounters(String queuePath, String category, String counterName, long value)
           
 void incrementQueueCounter(String queuePath, String name, long value)
           
 void incrementQueueCounters(String queuePath, Map<String,Long> counts)
           
 QueueManagerImpl init(QueueManagerFactoryImpl mmf, CassandraService cass, CounterUtils counterUtils, UUID applicationId)
           
 List<Message> postToQueue(String queuePath, List<Message> messages)
           
 Message postToQueue(String queuePath, Message message)
           
 QueueSet removeSubscribersFromQueue(String publisherQueuePath, List<String> subscriberQueuePaths)
           
 QueueSet searchQueueIndex(UUID publisherQueueId, QueryProcessor.QuerySlice slice, int count)
           
 TreeSet<UUID> searchQueueRange(me.prettyprint.hector.api.Keyspace ko, UUID queueId, QueueManagerImpl.QueueBounds bounds, TreeSet<UUID> uuid_set, UUID start_uuid, UUID finish_uuid, boolean reversed, QueryProcessor.QuerySlice slice, int limit)
           
 QueueSet searchSubscribers(String publisherQueuePath, Query query)
           
 QueueSet subscribeToQueue(String publisherQueuePath, String subscriberQueuePath)
           
 QueueSet subscribeToQueues(String subscriberQueuePath, List<String> publisherQueuePaths)
           
 QueueSet unsubscribeFromQueue(String publisherQueuePath, String subscriberQueuePath)
           
 QueueSet unsubscribeFromQueues(String subscriberQueuePath, List<String> publisherQueuePaths)
           
 Queue updateQueue(String queuePath, Map<String,Object> properties)
           
 Queue updateQueue(String queuePath, Queue queue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final org.slf4j.Logger logger

DICTIONARY_SUBSCRIBER_INDEXES

public static final String DICTIONARY_SUBSCRIBER_INDEXES
See Also:
Constant Field Values

DICTIONARY_MESSAGE_INDEXES

public static final String DICTIONARY_MESSAGE_INDEXES
See Also:
Constant Field Values

QUEUE_SHARD_INTERVAL

public static final int QUEUE_SHARD_INTERVAL
See Also:
Constant Field Values

INDEX_ENTRY_LIST_COUNT

public static final int INDEX_ENTRY_LIST_COUNT
See Also:
Constant Field Values

DEFAULT_SEARCH_COUNT

public static final int DEFAULT_SEARCH_COUNT
See Also:
Constant Field Values

ALL_COUNT

public static final int ALL_COUNT
See Also:
Constant Field Values

se

public static final me.prettyprint.cassandra.serializers.StringSerializer se

be

public static final me.prettyprint.cassandra.serializers.ByteBufferSerializer be

ue

public static final me.prettyprint.cassandra.serializers.UUIDSerializer ue

bae

public static final me.prettyprint.cassandra.serializers.BytesArraySerializer bae

dce

public static final me.prettyprint.cassandra.serializers.DynamicCompositeSerializer dce

le

public static final me.prettyprint.cassandra.serializers.LongSerializer le
Constructor Detail

QueueManagerImpl

public QueueManagerImpl()
Method Detail

init

public QueueManagerImpl init(QueueManagerFactoryImpl mmf,
                             CassandraService cass,
                             CounterUtils counterUtils,
                             UUID applicationId)

getMessage

public Message getMessage(UUID messageId)
Specified by:
getMessage in interface QueueManager

batchPostToQueue

public Message batchPostToQueue(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                String queuePath,
                                Message message,
                                MessageIndexUpdate indexUpdate,
                                long timestamp)

postToQueue

public Message postToQueue(String queuePath,
                           Message message)
Specified by:
postToQueue in interface QueueManager

postToQueue

public List<Message> postToQueue(String queuePath,
                                 List<Message> messages)
Specified by:
postToQueue in interface QueueManager

getNewClient

public UUID getNewClient(UUID applicationId)

getConsumerQueuePosition

public UUID getConsumerQueuePosition(me.prettyprint.hector.api.Keyspace ko,
                                     UUID consumerId,
                                     UUID queueId)

getQueueBounds

public QueueManagerImpl.QueueBounds getQueueBounds(me.prettyprint.hector.api.Keyspace ko,
                                                   UUID queueId)

getQueueRange

public TreeSet<UUID> getQueueRange(me.prettyprint.hector.api.Keyspace ko,
                                   UUID queueId,
                                   QueueManagerImpl.QueueBounds bounds,
                                   TreeSet<UUID> uuid_set,
                                   UUID start_uuid,
                                   UUID finish_uuid,
                                   boolean reversed,
                                   int limit)

searchQueueRange

public TreeSet<UUID> searchQueueRange(me.prettyprint.hector.api.Keyspace ko,
                                      UUID queueId,
                                      QueueManagerImpl.QueueBounds bounds,
                                      TreeSet<UUID> uuid_set,
                                      UUID start_uuid,
                                      UUID finish_uuid,
                                      boolean reversed,
                                      QueryProcessor.QuerySlice slice,
                                      int limit)

getFromQueue

public QueueResults getFromQueue(String queuePath,
                                 QueueQuery query)
Specified by:
getFromQueue in interface QueueManager

batchSubscribeToQueue

public void batchSubscribeToQueue(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                  String publisherQueuePath,
                                  UUID publisherQueueId,
                                  String subscriberQueuePath,
                                  UUID subscriberQueueId,
                                  long timestamp)

subscribeToQueue

public QueueSet subscribeToQueue(String publisherQueuePath,
                                 String subscriberQueuePath)
Specified by:
subscribeToQueue in interface QueueManager

batchUnsubscribeFromQueue

public void batchUnsubscribeFromQueue(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                      String publisherQueuePath,
                                      UUID publisherQueueId,
                                      String subscriberQueuePath,
                                      UUID subscriberQueueId,
                                      long timestamp)

unsubscribeFromQueue

public QueueSet unsubscribeFromQueue(String publisherQueuePath,
                                     String subscriberQueuePath)
Specified by:
unsubscribeFromQueue in interface QueueManager

getSubscribers

public QueueSet getSubscribers(String publisherQueuePath,
                               String firstSubscriberQueuePath,
                               int limit)
Specified by:
getSubscribers in interface QueueManager

getSubscriptions

public QueueSet getSubscriptions(String subscriberQueuePath,
                                 String firstSubscriptionQueuePath,
                                 int limit)
Specified by:
getSubscriptions in interface QueueManager

addSubscribersToQueue

public QueueSet addSubscribersToQueue(String publisherQueuePath,
                                      List<String> subscriberQueuePaths)
Specified by:
addSubscribersToQueue in interface QueueManager

removeSubscribersFromQueue

public QueueSet removeSubscribersFromQueue(String publisherQueuePath,
                                           List<String> subscriberQueuePaths)
Specified by:
removeSubscribersFromQueue in interface QueueManager

subscribeToQueues

public QueueSet subscribeToQueues(String subscriberQueuePath,
                                  List<String> publisherQueuePaths)
Specified by:
subscribeToQueues in interface QueueManager

unsubscribeFromQueues

public QueueSet unsubscribeFromQueues(String subscriberQueuePath,
                                      List<String> publisherQueuePaths)
Specified by:
unsubscribeFromQueues in interface QueueManager

incrementAggregateQueueCounters

public void incrementAggregateQueueCounters(String queuePath,
                                            String category,
                                            String counterName,
                                            long value)
Specified by:
incrementAggregateQueueCounters in interface QueueManager

getAggregateCounters

public AggregateCounterSet getAggregateCounters(UUID queueId,
                                                String category,
                                                String counterName,
                                                CounterResolution resolution,
                                                long start,
                                                long finish,
                                                boolean pad)

getAggregateCounters

public List<AggregateCounterSet> getAggregateCounters(UUID queueId,
                                                      CounterQuery query)
                                               throws Exception
Throws:
Exception

getAggregateQueueCounters

public Results getAggregateQueueCounters(String queuePath,
                                         String category,
                                         String counterName,
                                         CounterResolution resolution,
                                         long start,
                                         long finish,
                                         boolean pad)
Specified by:
getAggregateQueueCounters in interface QueueManager

getAggregateQueueCounters

public Results getAggregateQueueCounters(String queuePath,
                                         CounterQuery query)
                                  throws Exception
Specified by:
getAggregateQueueCounters in interface QueueManager
Throws:
Exception

incrementQueueCounters

public void incrementQueueCounters(String queuePath,
                                   Map<String,Long> counts)
Specified by:
incrementQueueCounters in interface QueueManager

incrementQueueCounter

public void incrementQueueCounter(String queuePath,
                                  String name,
                                  long value)
Specified by:
incrementQueueCounter in interface QueueManager

getQueueCounters

public Map<String,Long> getQueueCounters(UUID queueId)
                                  throws Exception
Throws:
Exception

getQueueCounters

public Map<String,Long> getQueueCounters(String queuePath)
                                  throws Exception
Specified by:
getQueueCounters in interface QueueManager
Throws:
Exception

getQueueCounterNames

public Set<String> getQueueCounterNames(String queuePath)
                                 throws Exception
Specified by:
getQueueCounterNames in interface QueueManager
Throws:
Exception

getQueue

public Queue getQueue(String queuePath,
                      UUID queueId)

getQueue

public Queue getQueue(String queuePath)
Specified by:
getQueue in interface QueueManager

updateQueue

public Queue updateQueue(String queuePath,
                         Queue queue)
Specified by:
updateQueue in interface QueueManager

updateQueue

public Queue updateQueue(String queuePath,
                         Map<String,Object> properties)
Specified by:
updateQueue in interface QueueManager

batchUpdateQueuePropertiesIndexes

public void batchUpdateQueuePropertiesIndexes(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                              String subscriberQueuePath,
                                              UUID subscriberQueueId,
                                              Map<String,Object> properties,
                                              UUID timestampUuid)
                                       throws Exception
Throws:
Exception

batchUpdateQueuePropertiesIndexes

public void batchUpdateQueuePropertiesIndexes(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                              UUID publisherQueueId,
                                              String subscriberQueuePath,
                                              UUID subscriberQueueId,
                                              Map<String,Object> properties,
                                              UUID timestampUuid)
                                       throws Exception
Throws:
Exception

batchUpdateQueueIndex

public QueueIndexUpdate batchUpdateQueueIndex(QueueIndexUpdate indexUpdate,
                                              UUID subcriptionQueueId)
                                       throws Exception
Throws:
Exception

batchStartQueueIndexUpdate

public QueueIndexUpdate batchStartQueueIndexUpdate(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                   String queuePath,
                                                   UUID queueId,
                                                   String entryName,
                                                   Object entryValue,
                                                   UUID timestampUuid)
                                            throws Exception
Throws:
Exception

searchQueueIndex

public QueueSet searchQueueIndex(UUID publisherQueueId,
                                 QueryProcessor.QuerySlice slice,
                                 int count)
                          throws Exception
Throws:
Exception

searchSubscribers

public QueueSet searchSubscribers(String publisherQueuePath,
                                  Query query)
Specified by:
searchSubscribers in interface QueueManager

getQueues

public QueueSet getQueues(String firstQueuePath,
                          int limit)
Specified by:
getQueues in interface QueueManager

getChildQueues

public QueueSet getChildQueues(String publisherQueuePath,
                               String firstQueuePath,
                               int count)
Specified by:
getChildQueues in interface QueueManager

getNewConsumerId

public UUID getNewConsumerId()
Specified by:
getNewConsumerId in interface QueueManager


Copyright © 2013. All Rights Reserved.