io.vlingo.actors.Returns Java Examples

The following examples show how to use io.vlingo.actors.Returns. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PooledCompletesProviderTest.java    From vlingo-actors with Mozilla Public License 2.0 6 votes vote down vote up
@Test
public void testCompletesAddressMatches() {
  ConfigureWorldWithPooledCompletes();

  final MockCompletes<Object> clientCompletes1 = new MockCompletes<>(1);
  final MockCompletes<Object> clientCompletes2 = new MockCompletes<>(1);

  final CompletesEventually completes1 = world.completesFor(Returns.value(clientCompletes1));
  completes1.with(5);

  final CompletesEventually completes2 = world.completesFor(completes1.address(), Returns.value(clientCompletes2));
  completes2.with(10);

  assertEquals(1, clientCompletes1.getWithCount());
  assertEquals(5, clientCompletes1.outcome());
  assertEquals(1, clientCompletes2.getWithCount());
  assertEquals(10, clientCompletes2.outcome());
  assertEquals(completes1, completes2);
}
 
Example #2
Source File: ServerActor.java    From vlingo-http with Mozilla Public License 2.0 6 votes vote down vote up
private Context consume(
            final RequestResponseContext<?> requestResponseContext,
            final Request request,
            final boolean wasIncompleteContent) {

//    logger().debug("==============(" + instanceId + ") FULL REQUEST (" + (++fullCount) + "): \n" + unfilteredRequest);

      final boolean keepAlive = determineKeepAlive(requestResponseContext, request);
      final Request filteredRequest = filters.process(request);
      final Completes<Response> completes = responseCompletes.of(requestResponseContext, /*unfilteredRequest,*/ false, filteredRequest.headers.headerOf(RequestHeader.XCorrelationID), keepAlive);
      final Context context = new Context(requestResponseContext, filteredRequest, world.completesFor(Returns.value(completes)));
      dispatcher.dispatchFor(context);

      if (wasIncompleteContent) {
        requestsMissingContent.remove(requestResponseContext.id());
      }

      return context;
    }
 
Example #3
Source File: ClientCorrelatingRequesterConsumerActor.java    From vlingo-http with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * @see io.vlingo.http.resource.ClientConsumer#requestWith(io.vlingo.http.Request, io.vlingo.common.Completes)
 */
@Override
public Completes<Response> requestWith(final Request request, final Completes<Response> completes) {
  RequestHeader correlationId = request.headers.headerOf(RequestHeader.XCorrelationID);

  final Request readyRequest;

  if (correlationId == null) {
    correlationId = RequestHeader.of(RequestHeader.XCorrelationID, UUID.randomUUID().toString());
    readyRequest = request.and(correlationId);
  } else {
    readyRequest = request;
  }

  completables.put(correlationId.value, stage().world().completesFor(Returns.value(completes)));

  state.buffer.clear();
  state.buffer.put(Converters.textToBytes(readyRequest.toString()));
  state.buffer.flip();
  state.channel.requestWith(state.buffer);

  return completes;
}
 
Example #4
Source File: ClientConsumerWorkerActor.java    From vlingo-http with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * @see io.vlingo.http.resource.ClientConsumer#requestWith(io.vlingo.http.Request, io.vlingo.common.Completes)
 */
@Override
public Completes<Response> requestWith(final Request request, final Completes<Response> completes) {
  completesEventually = stage().world().completesFor(Returns.value(completes));

  if (testId != EmptyTestId) {
    request.headers.add(RequestHeader.of(Client.ClientIdCustomHeader, testId));
    request.headers.add(RequestHeader.of(RequestHeader.XCorrelationID, testId));
    logger().debug("Client Worker: " + testId + " Requesting");
    logger().debug("Client Worker: " + testId + "\nRequesting:\n" + request);
  }

  requestSender.sendRequest(request);

  stowMessages(ResponseChannelConsumer.class);

  return completes;
}
 
Example #5
Source File: GridApplicationMessageHandler.java    From vlingo-lattice with Mozilla Public License 2.0 6 votes vote down vote up
private Returns<?> returnsAnswer(final Id receiver, final Id sender, final Deliver<?> deliver) {
  final Returns<?> returns;
  if (deliver.answerCorrelationId == null) {
    returns = null;
  } else {
    returns = Returns.value(
        Completes.using(scheduler)
            .andThen(result -> new Answer<>(deliver.answerCorrelationId, result))
            .recoverFrom(error -> new Answer<>(deliver.answerCorrelationId, error))
            .otherwise(ignored -> new Answer<>(deliver.answerCorrelationId, new TimeoutException()))
            .andThenConsume(4000,
                answer -> outbound.answer(sender, receiver, answer))
            .andFinally()
    );
  }
  return returns;
}
 
Example #6
Source File: Deliver.java    From vlingo-lattice with Mozilla Public License 2.0 6 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Function<io.vlingo.actors.Message, Deliver<?>> from(BiConsumer<UUID, Returns<?>> correlation) {
  return (message) -> {
    final LocalMessage<?> __message = (LocalMessage<?>) message;
    final Optional<Returns<?>> returns = Optional.ofNullable(__message.returns());

    final UUID answerCorrelationId = returns.map(_return -> {
      final UUID correlationId = UUID.randomUUID();
      correlation.accept(correlationId, _return);
      return correlationId;
    }).orElse(null);

    return new Deliver(
        __message.protocol(),
        __message.actor().address(),
        Definition.SerializationProxy.from(__message.actor().definition()),
        __message.consumer(),
        answerCorrelationId,
        __message.representation());
  };
}
 
Example #7
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> get(io.vlingo.lattice.grid.spaces.Key arg0, io.vlingo.lattice.grid.spaces.Period arg1) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.get(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1));
    final io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), getRepresentation1); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), getRepresentation1)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, getRepresentation1));
  }
  return null;
}
 
Example #8
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<io.vlingo.lattice.grid.spaces.KeyItem<T>> put(io.vlingo.lattice.grid.spaces.Key arg0, io.vlingo.lattice.grid.spaces.Item<T> arg1) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.put(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1));
    final io.vlingo.common.Completes<io.vlingo.lattice.grid.spaces.KeyItem<T>> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), putRepresentation2); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), putRepresentation2)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, putRepresentation2));
  }
  return null;
}
 
Example #9
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public io.vlingo.common.Completes<java.lang.String> name() {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.name();
    final io.vlingo.common.Completes<java.lang.String> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), nameRepresentation1); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), nameRepresentation1)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, nameRepresentation1));
  }
  return null;
}
 
Example #10
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> take(io.vlingo.lattice.grid.spaces.Key arg0, io.vlingo.lattice.grid.spaces.Period arg1) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.take(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1));
    final io.vlingo.common.Completes<java.util.Optional<io.vlingo.lattice.grid.spaces.KeyItem<T>>> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), takeRepresentation3); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), takeRepresentation3)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, takeRepresentation3));
  }
  return null;
}
 
Example #11
Source File: Space__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T>io.vlingo.common.Completes<T> itemFor(java.lang.Class<T> arg0, java.lang.Class<? extends io.vlingo.actors.Actor> arg1, java.lang.Object... arg2) {
  if (!actor.isStopped()) {
    ActorProxyBase<Space> self = this;
    final SerializableConsumer<Space> consumer = (actor) -> actor.itemFor(ActorProxyBase.thunk(self, (Actor)actor, arg0), ActorProxyBase.thunk(self, (Actor)actor, arg1), ActorProxyBase.thunk(self, (Actor)actor, arg2));
    final io.vlingo.common.Completes<T> returnValue = Completes.using(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Space.class, consumer, Returns.value(returnValue), itemForRepresentation4); }
    else { mailbox.send(new LocalMessage<Space>(actor, Space.class, consumer, Returns.value(returnValue), itemForRepresentation4)); }
    return returnValue;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, itemForRepresentation4));
  }
  return null;
}
 
Example #12
Source File: OutboundGridActorControl.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
public OutboundGridActorControl(
        final Id localNodeId,
        final Encoder encoder,
        final BiConsumer<UUID, Returns<?>> correlation,
        final OutBuffers outBuffers) {

  this(localNodeId, null, encoder, correlation, outBuffers);
}
 
Example #13
Source File: OutboundGridActorControl.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
public OutboundGridActorControl(
        final Id localNodeId,
        final ApplicationOutboundStream stream,
        final Encoder encoder,
        final BiConsumer<UUID, Returns<?>> correlation,
        final OutBuffers outBuffers) {

  this.localNodeId = localNodeId;
  this.stream = stream;
  this.encoder = encoder;
  this.correlation = correlation;
  this.outBuffers = outBuffers;
}
 
Example #14
Source File: OutboundGridActorControl.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
public OutboundGridActorControlInstantiator(
        final Id id,
        final FSTEncoder fstEncoder,
        final BiConsumer<UUID, Returns<?>> correlation,
        final OutBuffers outBuffers) {
  this.id = id;
  this.fstEncoder = fstEncoder;
  this.correlation = correlation;
  this.outBuffers = outBuffers;
}
 
Example #15
Source File: GridActorControl.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
<T> void deliver(
final Id recipient,
final Id sender,
final Returns<?> returns,
final Class<T> protocol,
final Address address,
final Definition.SerializationProxy definitionProxy,
final SerializableConsumer<T> consumer,
final String representation);
 
Example #16
Source File: ServerActor.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
    public void closeWith(final RequestResponseContext<?> requestResponseContext, final Object data) {
//    logger().debug("===================== CLOSE WITH: " + data);
      if (data != null) {
        final Request request = filters.process((Request) data);
        final Completes<Response> completes = responseCompletes.of(requestResponseContext, /*request,*/ false, request.headers.headerOf(RequestHeader.XCorrelationID), true);
        final Context context = new Context(requestResponseContext, request, world.completesFor(Returns.value(completes)));
        dispatcher.dispatchFor(context);
      }
    }
 
Example #17
Source File: PooledCompletesProviderTest.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void testActuallyCompletes() {
  ConfigureWorldWithPooledCompletes();

  final MockCompletes<Object> clientCompletes = new MockCompletes<>(1);

  final CompletesEventually asyncCompletes = world.completesFor(Returns.value(clientCompletes));
  asyncCompletes.with(5);

  assertEquals(1, clientCompletes.getWithCount());
  assertEquals(5, clientCompletes.outcome());
}
 
Example #18
Source File: PooledCompletesProviderTest.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void testCompletableFuture() throws ExecutionException, InterruptedException {
  ConfigureWorldWithPooledCompletes();

  final CompletableFuture<Integer> completableFuture = new CompletableFuture<>();

  final CompletesEventually completes1 = world.completesFor(Returns.value(completableFuture));
  completes1.with(5);

  assertEquals(5, completableFuture.get().intValue());
}
 
Example #19
Source File: PooledCompletesProviderTest.java    From vlingo-actors with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void testFuture() throws ExecutionException, InterruptedException {
  ConfigureWorldWithPooledCompletes();

  final CompletableFuture<Integer> completableFuture = new CompletableFuture<>();

  final CompletesEventually completes1 = world.completesFor(Returns.value(completableFuture));
  completes1.with(5);

  assertEquals(5, completableFuture.get().intValue());
}
 
Example #20
Source File: StateStoreEntryReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public io.vlingo.common.Completes<java.lang.String> name() {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStoreEntryReader> consumer = (actor) -> actor.name();
    final io.vlingo.common.Completes<java.lang.String> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), nameRepresentation1); }
    else { mailbox.send(new LocalMessage<StateStoreEntryReader>(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), nameRepresentation1)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, nameRepresentation1));
  }
  return null;
}
 
Example #21
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public io.vlingo.common.Completes<java.lang.String> seekTo(java.lang.String arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.seekTo(arg0);
    final io.vlingo.common.Completes<java.lang.String> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), seekToRepresentation3); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), seekToRepresentation3)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, seekToRepresentation3));
  }
  return null;
}
 
Example #22
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public io.vlingo.common.Completes<T> readNext() {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.readNext();
    final io.vlingo.common.Completes<T> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation4); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation4)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readNextRepresentation4));
  }
  return null;
}
 
Example #23
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public io.vlingo.common.Completes<T> readNext(final String fromId) {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.readNext(fromId);
    final io.vlingo.common.Completes<T> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation4); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation4)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readNextRepresentation4));
  }
  return null;
}
 
Example #24
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public io.vlingo.common.Completes<java.util.List<T>> readNext(int arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.readNext(arg0);
    final io.vlingo.common.Completes<java.util.List<T>> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation5); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation5)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readNextRepresentation5));
  }
  return null;
}
 
Example #25
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public io.vlingo.common.Completes<java.util.List<T>> readNext(final String fromId, int arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.readNext(fromId, arg0);
    final io.vlingo.common.Completes<java.util.List<T>> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation5); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), readNextRepresentation5)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readNextRepresentation5));
  }
  return null;
}
 
Example #26
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public Completes<Long> size() {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.size();
    final io.vlingo.common.Completes<Long> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), sizeRepresentation6); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), sizeRepresentation6)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, sizeRepresentation6));
  }
  return null;
}
 
Example #27
Source File: JournalReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public Completes<Stream> streamAll() {
  if (!actor.isStopped()) {
    final SerializableConsumer<JournalReader> consumer = (actor) -> actor.streamAll();
    final io.vlingo.common.Completes<Stream> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, JournalReader.class, consumer, Returns.value(completes), sizeRepresentation7); }
    else { mailbox.send(new LocalMessage<JournalReader>(actor, JournalReader.class, consumer, Returns.value(completes), sizeRepresentation7)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, sizeRepresentation7));
  }
  return null;
}
 
Example #28
Source File: ObjectStore__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Completes<EntryReader<? extends Entry<?>>> entryReader(final String arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<ObjectStore> consumer = (actor) -> actor.entryReader(arg0);
    final Completes<EntryReader<? extends Entry<?>>> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, ObjectStore.class, consumer, Returns.value(completes), entryReaderRepresentation2); }
    else { mailbox.send(new LocalMessage<ObjectStore>(actor, ObjectStore.class, consumer, Returns.value(completes), entryReaderRepresentation2)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, entryReaderRepresentation2));
  }
  return null;
}
 
Example #29
Source File: StateStoreEntryReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public io.vlingo.common.Completes<java.lang.Long> size() {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStoreEntryReader> consumer = (actor) -> actor.size();
    final io.vlingo.common.Completes<java.lang.Long> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), sizeRepresentation2); }
    else { mailbox.send(new LocalMessage<StateStoreEntryReader>(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), sizeRepresentation2)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, sizeRepresentation2));
  }
  return null;
}
 
Example #30
Source File: StateStoreEntryReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public io.vlingo.common.Completes<java.util.List<T>> readNext(int arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStoreEntryReader> consumer = (actor) -> actor.readNext(arg0);
    final io.vlingo.common.Completes<java.util.List<T>> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), readNextRepresentation5); }
    else { mailbox.send(new LocalMessage<StateStoreEntryReader>(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), readNextRepresentation5)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readNextRepresentation5));
  }
  return null;
}