Esempio n. 1
0
  public InboxQueue(
      ServicesAmp manager,
      QueueDeliverBuilderImpl<MessageAmp> queueBuilder,
      QueueServiceFactoryInbox serviceQueueFactory,
      ServiceConfig config) {
    super(manager);

    _isFiner = log.isLoggable(Level.FINER);

    _inboxMessage = new InboxMessage(this);

    StubAmp stubMain = serviceQueueFactory.stubMain();

    String name = stubMain.name();

    if (name != null) {
    } else if (config.address() != null) {
      name = config.address();
    } else if (config.name() != null) {
      name = config.name();
    } else {
      TypeRef typeRef = TypeRef.of(stubMain.api().getType());
      name = "anon:" + typeRef.rawClass().getSimpleName();
    }

    _anonAddress = name;

    if (config.isPublic()) {
      _serviceRef = new ServiceRefPublic(stubMain, this);
    } else {
      _serviceRef = new ServiceRefLocal(stubMain, this);
    }

    // queueBuilder.setOutboxContext(new OutboxContextAmpImpl(this));
    queueBuilder.setOutboxContext(this);

    _queue = serviceQueueFactory.build(queueBuilder, this);

    _worker = worker(_queue);

    _stubMain = stubMain;

    _isLifecycleAware = stubMain.isLifecycleAware() || !_queue.isSingleWorker();

    long timeout = config.queueTimeout();

    if (timeout < 0) {
      timeout = 60 * 1000L;
    }

    _sendTimeout = timeout;

    QueueFullHandler handler = config.queueFullHandler();

    if (handler == null) {
      handler = manager.queueFullHandler();
    }

    _fullHandler = handler;

    // start(actor);
  }
Esempio n. 2
0
  public String getDebugName() {
    TypeRef typeRef = TypeRef.of(_stubMain.api().getType());

    return typeRef.rawClass().getSimpleName() + "-" + manager().getDebugId();
  }