io.vlingo.common.SerializableConsumer Java Examples

The following examples show how to use io.vlingo.common.SerializableConsumer. 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: Journal__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public io.vlingo.common.Completes<io.vlingo.symbio.store.journal.StreamReader<T>> streamReader(final java.lang.String arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<Journal> consumer = (actor) -> actor.streamReader(arg0);
    final io.vlingo.common.Completes<io.vlingo.symbio.store.journal.StreamReader<T>> completes = new BasicCompletes<>(
            actor.scheduler());
    if (mailbox.isPreallocated()) {
      mailbox.send(actor, Journal.class, consumer, Returns.value(completes), streamReaderRepresentation6);
    } else {
      mailbox.send(new LocalMessage<>(actor, Journal.class, consumer, Returns.value(completes), streamReaderRepresentation6));
    }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, streamReaderRepresentation6));
  }
  return null;
}
 
Example #2
Source File: SsePublisher__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void unsubscribe(io.vlingo.http.resource.sse.SseSubscriber arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<SsePublisher> consumer = (actor) -> actor.unsubscribe(arg0);
    if (mailbox.isPreallocated()) { mailbox.send(actor, SsePublisher.class, consumer, null, unsubscribeRepresentation2); }
    else { mailbox.send(new LocalMessage<SsePublisher>(actor, SsePublisher.class, consumer, unsubscribeRepresentation2)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, unsubscribeRepresentation2));
  }
}
 
Example #3
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 #4
Source File: Server__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Completes<Boolean> startUp() {
  if (!actor.isStopped()) {
    final SerializableConsumer<Server> consumer = (actor) -> actor.startUp();
    final Completes<Boolean> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, Server.class, consumer, Returns.value(completes), startUpRepresentation2); }
    else { mailbox.send(new LocalMessage<Server>(actor, Server.class, consumer, Returns.value(completes), startUpRepresentation2)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, startUpRepresentation2));
  }
  return null;
}
 
Example #5
Source File: RequestSender__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void conclude() {
  if (!actor.isStopped()) {
    final SerializableConsumer<Stoppable> consumer = (actor) -> actor.conclude();
    if (mailbox.isPreallocated()) { mailbox.send(actor, Stoppable.class, consumer, null, representationConclude0); }
    else { mailbox.send(new LocalMessage<Stoppable>(actor, Stoppable.class, consumer, representationConclude0)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, representationConclude0));
  }
}
 
Example #6
Source File: ConfirmDispatchedResultInterest__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
public void confirmDispatchedResultedIn(io.vlingo.symbio.store.Result arg0, java.lang.String arg1) {
  if (!actor.isStopped()) {
    final SerializableConsumer<ConfirmDispatchedResultInterest> consumer = (actor) -> actor.confirmDispatchedResultedIn(arg0, arg1);
    if (mailbox.isPreallocated()) { mailbox.send(actor, ConfirmDispatchedResultInterest.class, consumer, null, confirmDispatchedResultedInRepresentation1); }
    else { mailbox.send(new LocalMessage<ConfirmDispatchedResultInterest>(actor, ConfirmDispatchedResultInterest.class, consumer, confirmDispatchedResultedInRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, confirmDispatchedResultedInRepresentation1));
  }
}
 
Example #7
Source File: Dispatcher__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
private void send(final SerializableConsumer<Dispatcher> consumer, final String representation) {
  if (!actor.isStopped()) {
    if (mailbox.isPreallocated()) {
      mailbox.send(actor, Dispatcher.class, consumer, null, representation);
    } else {
      mailbox.send(new LocalMessage<>(actor, Dispatcher.class, consumer, representation));
    }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, representation));
  }
}
 
Example #8
Source File: ClientConsumer__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Completes<Response> requestWith(io.vlingo.http.Request arg0, io.vlingo.common.Completes<Response> arg1) {
  if (!actor.isStopped()) {
    final SerializableConsumer<ClientConsumer> consumer = (actor) -> actor.requestWith(arg0, arg1);
    final Completes<Response> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, ClientConsumer.class, consumer, Returns.value(completes), requestWithRepresentation1); }
    else { mailbox.send(new LocalMessage<ClientConsumer>(actor, ClientConsumer.class, consumer, Returns.value(completes), requestWithRepresentation1)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, requestWithRepresentation1));
  }
  return null;
}
 
Example #9
Source File: DispatcherControl__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
private void send(final SerializableConsumer<DispatcherControl> consumer, final String representation) {
  if (!actor.isStopped()) {
    if (mailbox.isPreallocated()) {
      mailbox.send(actor, DispatcherControl.class, consumer, null, representation);
    } else {
      mailbox.send(new LocalMessage<>(actor, DispatcherControl.class, consumer, representation));
    }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, representation));
  }
}
 
Example #10
Source File: Dispatcher__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void dispatchFor(io.vlingo.http.Context arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<Dispatcher> consumer = (actor) -> actor.dispatchFor(arg0);
    if (mailbox.isPreallocated()) { mailbox.send(actor, Dispatcher.class, consumer, null, dispatchForRepresentation1); }
    else { mailbox.send(new LocalMessage<Dispatcher>(actor, Dispatcher.class, consumer, dispatchForRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, dispatchForRepresentation1));
  }
}
 
Example #11
Source File: Projection__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
public void projectWith(io.vlingo.lattice.model.projection.Projectable arg0, io.vlingo.lattice.model.projection.ProjectionControl arg1) {
  if (!actor.isStopped()) {
    final SerializableConsumer<Projection> consumer = (actor) -> actor.projectWith(arg0, arg1);
    if (mailbox.isPreallocated()) { mailbox.send(actor, Projection.class, consumer, null, projectWithRepresentation1); }
    else { mailbox.send(new LocalMessage<Projection>(actor, Projection.class, consumer, projectWithRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, projectWithRepresentation1));
  }
}
 
Example #12
Source File: Deliver.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
public Deliver(final Class<T> protocol,
               final Address address,
               final Definition.SerializationProxy definition,
               final SerializableConsumer<T> consumer,
               final String representation) {
  this(protocol, address, definition, consumer, null, representation);
}
 
Example #13
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 #14
Source File: ProjectionDispatcher__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
public void projectTo(io.vlingo.lattice.model.projection.Projection arg0, java.lang.String[] arg1) {
  if (!actor.isStopped()) {
    final SerializableConsumer<ProjectionDispatcher> consumer = (actor) -> actor.projectTo(arg0, arg1);
    if (mailbox.isPreallocated()) { mailbox.send(actor, ProjectionDispatcher.class, consumer, null, projectToRepresentation1); }
    else { mailbox.send(new LocalMessage<ProjectionDispatcher>(actor, ProjectionDispatcher.class, consumer, projectToRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, projectToRepresentation1));
  }
}
 
Example #15
Source File: Dispatcher__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void conclude() {
  if (!actor.isStopped()) {
    final SerializableConsumer<Stoppable> consumer = (actor) -> actor.conclude();
    if (mailbox.isPreallocated()) { mailbox.send(actor, Stoppable.class, consumer, null, representationConclude0); }
    else { mailbox.send(new LocalMessage<Stoppable>(actor, Stoppable.class, consumer, representationConclude0)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, representationConclude0));
  }
}
 
Example #16
Source File: User__Proxy.java    From vlingo-examples with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void attachPrivateToken(String arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<User> consumer = (actor) -> actor.attachPrivateToken(arg0);
    mailbox.send(new LocalMessage<User>(actor, User.class, consumer, null, attachPrivateToken1));
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, attachPrivateToken1));
  }
}
 
Example #17
Source File: ObjectStore__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <T extends StateObject, E> void persist(final StateSources<T,E> arg0, final Metadata arg1,
        final long arg2, final PersistResultInterest arg3, final Object arg4) {
  final SerializableConsumer<ObjectStore> consumer = (actor) -> actor
          .persist(arg0, arg1, arg2, arg3, arg4);
  send(ObjectStore__Proxy.persistRepresentation15, consumer);
}
 
Example #18
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 #19
Source File: SsePublisher__Proxy.java    From vlingo-http with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void stop() {
  if (!actor.isStopped()) {
    final SerializableConsumer<SsePublisher> consumer = (actor) -> actor.stop();
    if (mailbox.isPreallocated()) { mailbox.send(actor, SsePublisher.class, consumer, null, stopRepresentation3); }
    else { mailbox.send(new LocalMessage<SsePublisher>(actor, SsePublisher.class, consumer, stopRepresentation3)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, stopRepresentation3));
  }
}
 
Example #20
Source File: Queries__Proxy.java    From vlingo-examples with Mozilla Public License 2.0 5 votes vote down vote up
public Completes<UserData> userDataOf(java.lang.String arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<Queries> consumer = (actor) -> actor.userDataOf(arg0);
    final Completes<io.vlingo.frontservice.data.UserData> completes = new BasicCompletes<>(actor.scheduler());
    mailbox.send(new LocalMessage<Queries>(actor, Queries.class, consumer, Returns.value(completes), userDataOfRepresentation2));
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, userDataOfRepresentation2));
  }
  return null;
}
 
Example #21
Source File: CommandRouter__Proxy.java    From vlingo-lattice with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public <P,C extends Command,A> void route(io.vlingo.lattice.router.RoutableCommand<P,C,A> arg0) {
  if (!actor.isStopped()) {
    ActorProxyBase<CommandRouter> self = this;
    final SerializableConsumer<CommandRouter> consumer = (a) -> a.route(ActorProxyBase.thunk(self, (Actor)a, arg0));
    if (mailbox.isPreallocated()) { mailbox.send(actor, CommandRouter.class, consumer, Returns.value(arg0.answer()), routeRepresentation1); }
    else { mailbox.send(new LocalMessage<CommandRouter>(actor, CommandRouter.class, consumer, Returns.value(arg0.answer()), routeRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, routeRepresentation1));
  }
}
 
Example #22
Source File: StateStore__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Completes<Stream> streamSomeUsing(final QueryExpression query) {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStore> consumer = (actor) -> actor.streamSomeUsing(query);
    final Completes<Stream> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStore.class, consumer, Returns.value(completes), streamSomeUsingRepresentation5); }
    else { mailbox.send(new LocalMessage<StateStore>(actor, StateStore.class, consumer, Returns.value(completes), streamSomeUsingRepresentation5)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, streamSomeUsingRepresentation5));
  }
  return null;
}
 
Example #23
Source File: StateStore__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Completes<Stream> streamAllOf(final Class<?> stateType) {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStore> consumer = (actor) -> actor.streamAllOf(stateType);
    final Completes<Stream> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStore.class, consumer, Returns.value(completes), streamAllOfRepresentation4); }
    else { mailbox.send(new LocalMessage<StateStore>(actor, StateStore.class, consumer, Returns.value(completes), streamAllOfRepresentation4)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, streamAllOfRepresentation4));
  }
  return null;
}
 
Example #24
Source File: User__Proxy.java    From vlingo-examples with Mozilla Public License 2.0 5 votes vote down vote up
public Completes<UserState> withName(Name arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<User> consumer = (actor) -> actor.withName(arg0);
    final Completes<UserState> completes = new BasicCompletes<>(actor.scheduler());
    mailbox.send(new LocalMessage<User>(actor, User.class, consumer, Returns.value(completes), withNameRepresentation3));
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, withNameRepresentation3));
  }
  return null;
}
 
Example #25
Source File: StateStore__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void readAll(final Collection<TypedStateBundle> arg0, final ReadResultInterest arg1, final Object arg2) {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStore> consumer = (actor) -> actor.readAll(arg0, arg1, arg2);
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStore.class, consumer, null, readRepresentation2a); }
    else { mailbox.send(new LocalMessage<StateStore>(actor, StateStore.class, consumer, readRepresentation2a)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readRepresentation2a));
  }
}
 
Example #26
Source File: StateStore__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void read(java.lang.String arg0, java.lang.Class<?> arg1, io.vlingo.symbio.store.state.StateStore.ReadResultInterest arg2, java.lang.Object arg3) {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStore> consumer = (actor) -> actor.read(arg0, arg1, arg2, arg3);
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStore.class, consumer, null, readRepresentation2); }
    else { mailbox.send(new LocalMessage<StateStore>(actor, StateStore.class, consumer, readRepresentation2)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readRepresentation2));
  }
}
 
Example #27
Source File: StateStoreReadResultInterest__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
public <S>void readResultedIn(io.vlingo.common.Outcome<io.vlingo.symbio.store.StorageException, io.vlingo.symbio.store.Result> arg0, java.lang.String arg1, S arg2, int arg3, io.vlingo.symbio.Metadata arg4, java.lang.Object arg5) {
  if (!actor.isStopped()) {
    final SerializableConsumer<ReadResultInterest> consumer = (actor) -> actor.readResultedIn(arg0, arg1, arg2, arg3, arg4, arg5);
    if (mailbox.isPreallocated()) { mailbox.send(actor, ReadResultInterest.class, consumer, null, readResultedInRepresentation1); }
    else { mailbox.send(new LocalMessage<ReadResultInterest>(actor, ReadResultInterest.class, consumer, readResultedInRepresentation1)); }
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readResultedInRepresentation1));
  }
}
 
Example #28
Source File: StateStoreEntryReader__Proxy.java    From vlingo-symbio with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Completes<Stream> streamAll() {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStoreEntryReader> consumer = (actor) -> actor.streamAll();
    final io.vlingo.common.Completes<Stream> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), streamAllRepresentation10); }
    else { mailbox.send(new LocalMessage<StateStoreEntryReader>(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), streamAllRepresentation10)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, streamAllRepresentation10));
  }
  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.String> seekTo(java.lang.String arg0) {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStoreEntryReader> consumer = (actor) -> actor.seekTo(arg0);
    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), seekToRepresentation9); }
    else { mailbox.send(new LocalMessage<StateStoreEntryReader>(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), seekToRepresentation9)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, seekToRepresentation9));
  }
  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<T> readNext() {
  if (!actor.isStopped()) {
    final SerializableConsumer<StateStoreEntryReader> consumer = (actor) -> actor.readNext();
    final io.vlingo.common.Completes<T> completes = new BasicCompletes<>(actor.scheduler());
    if (mailbox.isPreallocated()) { mailbox.send(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), readNextRepresentation8); }
    else { mailbox.send(new LocalMessage<StateStoreEntryReader>(actor, StateStoreEntryReader.class, consumer, Returns.value(completes), readNextRepresentation8)); }
    return completes;
  } else {
    actor.deadLetters().failedDelivery(new DeadLetter(actor, readNextRepresentation8));
  }
  return null;
}