io.vlingo.symbio.store.journal.Journal.AppendResultInterest Java Examples
The following examples show how to use
io.vlingo.symbio.store.journal.Journal.AppendResultInterest.
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: JournalAppendResultInterest__Proxy.java From vlingo-symbio with Mozilla Public License 2.0 | 5 votes |
private void send(final String representation, final SerializableConsumer<AppendResultInterest> consumer) { if (!actor.isStopped()) { if (mailbox.isPreallocated()) { mailbox.send(actor, AppendResultInterest.class, consumer, null, representation); } else { mailbox.send(new LocalMessage<>(actor, AppendResultInterest.class, consumer, representation)); } } else { actor.deadLetters().failedDelivery(new DeadLetter(actor, representation)); } }
Example #2
Source File: Sourced.java From vlingo-lattice with Mozilla Public License 2.0 | 5 votes |
/** * Construct my default state. * @param streamName the String unique identity of this entity */ protected Sourced(String streamName) { this.streamName = streamName != null ? streamName : address().idString();; this.currentVersion = 0; this.journalInfo = info(); this.interest = selfAs(AppendResultInterest.class); }
Example #3
Source File: JournalProjectionDispatcherTest.java From vlingo-lattice with Mozilla Public License 2.0 | 5 votes |
@Before @SuppressWarnings({ "rawtypes", "unchecked" }) public void setUp() { world = World.startWithDefaults("test-journal-projections"); accessHolder = new AccessHolder(); final List<ProjectToDescription> descriptions = Arrays.asList( ProjectToDescription.with(OneHappenedProjectionActor.class, Optional.of(accessHolder), OneHappened.class), ProjectToDescription.with(TwoHappenedProjectionActor.class, Optional.of(accessHolder), TwoHappened.class), ProjectToDescription.with(AllHappenedProjectionActor.class, Optional.of(accessHolder), OneHappened.class.getPackage())); final Protocols dispatcherProtocols = world.stage().actorFor( new Class<?>[] { Dispatcher.class, ProjectionDispatcher.class }, Definition.has(TextProjectionDispatcherActor.class, new TextProjectionDispatcherInstantiator(descriptions))); final Protocols.Two<Dispatcher, ProjectionDispatcher> dispatchers = Protocols.two(dispatcherProtocols); this.dispatcher = dispatchers._1; journal = Journal.using(world.stage(), InMemoryJournalActor.class, this.dispatcher); EntryAdapterProvider.instance(world).registerAdapter(OneHappened.class, new OneHappenedAdapter()); EntryAdapterProvider.instance(world).registerAdapter(TwoHappened.class, new TwoHappenedAdapter()); EntryAdapterProvider.instance(world).registerAdapter(ThreeHappened.class, new ThreeHappenedAdapter()); appendInterest = world.stage().actorFor(AppendResultInterest.class, JournalAppendResultInterest.class); }
Example #4
Source File: JournalAppendResultInterest__Proxy.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
public <S,ST>void appendResultedIn(final io.vlingo.common.Outcome<io.vlingo.symbio.store.StorageException, io.vlingo.symbio.store.Result> arg0, final java.lang.String arg1, final int arg2, io.vlingo.symbio.Source<S> arg3, final java.util.Optional<ST> arg4, final java.lang.Object arg5) { final SerializableConsumer<AppendResultInterest> consumer = (actor) -> actor.appendResultedIn(arg0, arg1, arg2, arg3, arg4, arg5); send(JournalAppendResultInterest__Proxy.appendResultedInRepresentation1, consumer); }
Example #5
Source File: JournalAppendResultInterest__Proxy.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
@Override public <S, ST> void appendResultedIn(final Outcome<StorageException, Result> outcome, final String streamName, final int streamVersion, Source<S> source, Metadata metadata, Optional<ST> snapshot, Object object) { final SerializableConsumer<AppendResultInterest> consumer = (actor) -> actor.appendResultedIn(outcome, streamName, streamVersion, source, metadata, snapshot, object); send(JournalAppendResultInterest__Proxy.appendResultedInRepresentation2, consumer); }
Example #6
Source File: JournalAppendResultInterest__Proxy.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
public <S,ST>void appendAllResultedIn(final io.vlingo.common.Outcome<io.vlingo.symbio.store.StorageException, io.vlingo.symbio.store.Result> arg0, final java.lang.String arg1, final int arg2, java.util.List<io.vlingo.symbio.Source<S>> arg3, final java.util.Optional<ST> arg4, final java.lang.Object arg5) { final SerializableConsumer<AppendResultInterest> consumer = (actor) -> actor.appendAllResultedIn(arg0, arg1, arg2, arg3, arg4, arg5); send(JournalAppendResultInterest__Proxy.appendAllResultedInRepresentation1, consumer); }
Example #7
Source File: JournalAppendResultInterest__Proxy.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
@Override public <S, ST> void appendAllResultedIn(final Outcome<StorageException, Result> outcome, final String streamName, final int streamVersion, final List<Source<S>> sources, final Metadata metadata, Optional<ST> snapshot, final Object object) { final SerializableConsumer<AppendResultInterest> consumer = (actor) -> actor.appendAllResultedIn(outcome, streamName, streamVersion, sources, metadata, snapshot, object); send(JournalAppendResultInterest__Proxy.appendAllResultedInRepresentation2, consumer); }
Example #8
Source File: Sourced.java From vlingo-lattice with Mozilla Public License 2.0 | 3 votes |
/** * Answer {@code Completes<RT>}, applying all of the given {@code sources} to myself, * which includes appending them to my journal and reflecting the representative changes * to my state, followed by the execution of a possible {@code andThen}. * @param sources the {@code List<Source<T>>} to apply * @param metadata the Metadata to apply along with source * @param andThen the {@code Supplier<R>} executed following the application of sources * @param <R> the return type of the andThen {@code Supplier<R>} * @return {@code Completes<R>} */ final protected <R> Completes<R> apply(final List<Source<T>> sources, final Metadata metadata, final Supplier<R> andThen) { beforeApply(sources); final Journal<?> journal = journalInfo.journal(); stowMessages(AppendResultInterest.class); journal.appendAllWith(this.streamName, nextVersion(), sources, metadata, snapshot(), interest, CompletionSupplier.supplierOrNull(andThen, completesEventually())); return andThen == null ? null : completes(); }
Example #9
Source File: Sourced.java From vlingo-lattice with Mozilla Public License 2.0 | 3 votes |
/** * Answer {@code Completes<R>}, applying the given {@code source} to myself, which * includes appending it to my journal and reflecting the representative changes to my * state, followed by the execution of a possible {@code andThen}. * @param source the {@code Source<T>} to apply * @param metadata the Metadata to apply along with source * @param andThen the {@code Supplier<R>} executed following the application of sources * @param <R> the return type of the andThen {@code Supplier<R>} * @return {@code Completes<R>} */ final protected <R> Completes<R> apply(final Source<T> source, final Metadata metadata, final Supplier<R> andThen) { final List<Source<T>> toApply = wrap(source); beforeApply(toApply); final Journal<?> journal = journalInfo.journal(); stowMessages(AppendResultInterest.class); journal.appendAllWith(this.streamName, nextVersion(), toApply, metadata, snapshot(), interest, CompletionSupplier.supplierOrNull(andThen, completesEventually())); return andThen == null ? null : completes(); }