コード例 #1
0
  public void batchUpdateQueuePropertiesIndexes(
      Mutator<ByteBuffer> batch,
      String subscriberQueuePath,
      UUID subscriberQueueId,
      Map<String, Object> properties,
      UUID timestampUuid)
      throws Exception {

    QueueSet subscriptions = getSubscriptions(subscriberQueuePath, null, ALL_COUNT);

    if (subscriptions != null) {

      for (Map.Entry<String, Object> property : properties.entrySet()) {

        if (!Queue.QUEUE_PROPERTIES.containsKey(property.getKey())) {

          QueueIndexUpdate indexUpdate =
              batchStartQueueIndexUpdate(
                  batch,
                  subscriberQueuePath,
                  subscriberQueueId,
                  property.getKey(),
                  property.getValue(),
                  timestampUuid);

          for (QueueInfo subscription : subscriptions.getQueues()) {
            batchUpdateQueueIndex(indexUpdate, subscription.getUuid());
          }
        }
      }
    }
  }
コード例 #2
0
  @Override
  public Message postToQueue(String queuePath, Message message) {
    long timestamp = cass.createTimestamp();
    Mutator<ByteBuffer> batch = createMutator(cass.getApplicationKeyspace(applicationId), be);

    queuePath = normalizeQueuePath(queuePath);

    MessageIndexUpdate indexUpdate = new MessageIndexUpdate(message);

    batchPostToQueue(batch, queuePath, message, indexUpdate, timestamp);

    batchExecute(batch, RETRY_COUNT);

    String firstSubscriberQueuePath = null;
    while (true) {

      QueueSet subscribers = getSubscribers(queuePath, firstSubscriberQueuePath, 1000);

      if (subscribers.getQueues().isEmpty()) {
        break;
      }

      batch = createMutator(cass.getApplicationKeyspace(applicationId), be);
      for (QueueInfo q : subscribers.getQueues()) {
        batchPostToQueue(batch, q.getPath(), message, indexUpdate, timestamp);

        firstSubscriberQueuePath = q.getPath();
      }
      batchExecute(batch, RETRY_COUNT);

      if (!subscribers.hasMore()) {
        break;
      }
    }

    return message;
  }