예제 #1
0
  /**
   * @param address
   * @param postOffice
   * @return
   * @throws Exception
   */
  protected int getMessageCount(final PostOffice postOffice, final String address)
      throws Exception {
    int messageCount = 0;

    List<QueueBinding> bindings = getLocalQueueBindings(postOffice, address);

    for (QueueBinding qBinding : bindings) {
      messageCount += qBinding.getQueue().getMessageCount();
    }

    return messageCount;
  }
예제 #2
0
  public ServerConsumerImpl(
      final long id,
      final ServerSession session,
      final QueueBinding binding,
      final Filter filter,
      final boolean started,
      final boolean browseOnly,
      final StorageManager storageManager,
      final SessionCallback callback,
      final boolean preAcknowledge,
      final boolean strictUpdateDeliveryCount,
      final ManagementService managementService)
      throws Exception {
    this.id = id;

    this.filter = filter;

    this.session = session;

    this.binding = binding;

    messageQueue = binding.getQueue();

    this.started = browseOnly || started;

    this.browseOnly = browseOnly;

    this.storageManager = storageManager;

    this.callback = callback;

    this.preAcknowledge = preAcknowledge;

    this.managementService = managementService;

    minLargeMessageSize = session.getMinLargeMessageSize();

    this.strictUpdateDeliveryCount = strictUpdateDeliveryCount;

    this.callback.addReadyListener(this);

    this.creationTime = System.currentTimeMillis();

    if (browseOnly) {
      browserDeliverer = new BrowserDeliverer(messageQueue.iterator());
    } else {
      messageQueue.addConsumer(this);
    }
  }