Java Code Examples for io.vlingo.symbio.EntryAdapterProvider#instance()
The following examples show how to use
io.vlingo.symbio.EntryAdapterProvider#instance() .
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: InMemoryObjectStoreActor.java From vlingo-symbio with Mozilla Public License 2.0 | 6 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public InMemoryObjectStoreActor( final List<Dispatcher<Dispatchable<BaseEntry<?>,State<?>>>> dispatchers, final long checkConfirmationExpirationInterval, final long confirmationExpiration ) { this.entryAdapterProvider = EntryAdapterProvider.instance(stage().world()); this.dispatchers = dispatchers; this.entryReaders = new HashMap<>(); this.storeDelegate = new InMemoryObjectStoreDelegate(StateAdapterProvider.instance(stage().world())); this.dispatcherControl = stage().actorFor( DispatcherControl.class, Definition.has( DispatcherControlActor.class, new DispatcherControlInstantiator( dispatchers, this.storeDelegate, checkConfirmationExpirationInterval, confirmationExpiration))); }
Example 2
Source File: SourcedTypeRegistry.java From vlingo-lattice with Mozilla Public License 2.0 | 6 votes |
/** * Construct my default state with {@code sourcedTypes} creating the {@code Journal} * of type {@code journalType}, and register me with the {@code world}. * @param world the World to which I am registered * @param journalType the concrete {@code Actor} type of the Journal to create * @param dispatcher the {@code Dispatcher<Dispatchable<Entry<?>,State<?>>>} of the journalType * @param sourcedTypes all {@code Class<Sourced<?>>} types of to register * @param <A> the type of Actor used for the Journal implementation * @param <S> the {@code Sourced<?>} types to register */ @SuppressWarnings({ "unchecked", "rawtypes" }) public <A extends Actor, S extends Sourced<?>> SourcedTypeRegistry( final World world, final Class<A> journalType, final Dispatcher<Dispatchable<Entry<?>,State<?>>> dispatcher, final Class<S> ... sourcedTypes) { this(world); final Journal<?> journal = world.actorFor(Journal.class, journalType, dispatcher); EntryAdapterProvider.instance(world); for (Class<S> sourcedType : sourcedTypes) { this.register(new Info(journal, sourcedType, sourcedType.getSimpleName())); } }
Example 3
Source File: EventSourcedTest.java From vlingo-lattice with Mozilla Public License 2.0 | 6 votes |
@Before @SuppressWarnings({ "unchecked", "rawtypes" }) public void setUp() { testWorld = TestWorld.startWithDefaults("test-es"); world = testWorld.world(); dispatcher = new MockJournalDispatcher(); EntryAdapterProvider entryAdapterProvider = EntryAdapterProvider.instance(world); entryAdapterProvider.registerAdapter(Test1Happened.class, new Test1HappenedAdapter()); entryAdapterProvider.registerAdapter(Test2Happened.class, new Test2HappenedAdapter()); entryAdapterProvider.registerAdapter(Test3Happened.class, new Test3HappenedAdapter()); journal = world.actorFor(Journal.class, InMemoryJournalActor.class, dispatcher); registry = new SourcedTypeRegistry(world); registry.register(new Info(journal, TestEventSourcedEntity.class, TestEventSourcedEntity.class.getSimpleName())); registry.register(new Info(journal, ProductEntity.class, ProductEntity.class.getSimpleName())); registry.register(new Info(journal, ProductParent.class, ProductParent.class.getSimpleName())); registry.register(new Info(journal, ProductGrandparent.class, ProductGrandparent.class.getSimpleName())); result = new Result(); entity = world.actorFor(Entity.class, TestEventSourcedEntity.class, result); }
Example 4
Source File: SourcedProcessTest.java From vlingo-lattice with Mozilla Public License 2.0 | 6 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) private <T extends Sourced<?>> void registerSourcedTypes(final Class<T> sourcedType) { EntryAdapterProvider entryAdapterProvider = EntryAdapterProvider.instance(world); sourcedTypeRegistry.register(new Info(journal, sourcedType, sourcedType.getSimpleName())); sourcedTypeRegistry.info(sourcedType) .registerEntryAdapter(ProcessMessage.class, new ProcessMessageTextAdapter(), (type, adapter) -> entryAdapterProvider.registerAdapter(type, adapter)) .registerEntryAdapter(DoStepOne.class, new DoStepOneAdapter(), (type, adapter) -> entryAdapterProvider.registerAdapter(type, adapter)) .registerEntryAdapter(DoStepTwo.class, new DoStepTwoAdapter(), (type, adapter) -> entryAdapterProvider.registerAdapter(type, adapter)) .registerEntryAdapter(DoStepThree.class, new DoStepThreeAdapter(), (type, adapter) -> entryAdapterProvider.registerAdapter(type, adapter)) .registerEntryAdapter(DoStepFour.class, new DoStepFourAdapter(), (type, adapter) -> entryAdapterProvider.registerAdapter(type, adapter)) .registerEntryAdapter(DoStepFive.class, new DoStepFiveAdapter(), (type, adapter) -> entryAdapterProvider.registerAdapter(type, adapter)); }
Example 5
Source File: InMemoryJournal.java From vlingo-symbio with Mozilla Public License 2.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) public InMemoryJournal( final List<Dispatcher<Dispatchable<Entry<T>,RS>>> dispatchers, final World world, final long checkConfirmationExpirationInterval, final long confirmationExpiration) { this.entryAdapterProvider = EntryAdapterProvider.instance(world); this.stateAdapterProvider = StateAdapterProvider.instance(world); this.journal = new ArrayList<>(); this.journalReaders = new HashMap<>(1); this.streamReaders = new HashMap<>(1); this.streamIndexes = new HashMap<>(); this.snapshots = new HashMap<>(); this.dispatchers = dispatchers; this.dispatchables = new CopyOnWriteArrayList<>(); final InMemoryDispatcherControlDelegate<Entry<T>, RS> dispatcherControlDelegate = new InMemoryDispatcherControlDelegate<>(dispatchables); this.dispatcherControl = world.stage().actorFor( DispatcherControl.class, Definition.has( DispatcherControlActor.class, new DispatcherControlInstantiator( dispatchers, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration))); }
Example 6
Source File: InMemoryStateStoreActor.java From vlingo-symbio with Mozilla Public License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public InMemoryStateStoreActor( final List<Dispatcher<Dispatchable<Entry<?>, RS>>> dispatchers, final long checkConfirmationExpirationInterval, final long confirmationExpiration) { if (dispatchers == null) { throw new IllegalArgumentException("Dispatcher must not be null."); } this.dispatchers = dispatchers; this.entryAdapterProvider = EntryAdapterProvider.instance(stage().world()); this.stateAdapterProvider = StateAdapterProvider.instance(stage().world()); this.entries = new CopyOnWriteArrayList<>(); this.entryReaders = new HashMap<>(); this.store = new HashMap<>(); this.dispatchables = new CopyOnWriteArrayList<>(); this.readAllResultCollector = new ReadAllResultCollector(); final InMemoryDispatcherControlDelegate<Entry<?>, RS> dispatcherControlDelegate = new InMemoryDispatcherControlDelegate<>(dispatchables); this.dispatcherControl = stage().actorFor( DispatcherControl.class, Definition.has( DispatcherControlActor.class, new DispatcherControlInstantiator( dispatchers, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration))); }
Example 7
Source File: StatefulProcessTest.java From vlingo-lattice with Mozilla Public License 2.0 | 5 votes |
@Before @SuppressWarnings({ "unchecked", "rawtypes" }) public void setUp() { world = World.startWithDefaults("five-step-process-test"); dispatcher = new MockTextDispatcher(); final MessageQueue queue = new AsyncMessageQueue(null); exchange = new LocalExchange(queue); stateStore = world.actorFor(StateStore.class, InMemoryStateStoreActor.class, Arrays.asList(dispatcher)); EntryAdapterProvider.instance(world); statefulTypeRegistry = new StatefulTypeRegistry(world); final Info<StepCountState> stepCountStateInfo = new StatefulTypeRegistry.Info( stateStore, StepCountState.class, StepCountState.class.getSimpleName()); statefulTypeRegistry.register(stepCountStateInfo); exchangeReceivers = new ExchangeReceivers(); exchangeSender = new LocalExchangeSender(queue); registerExchangeCoveys(); processTypeRegistry = new ProcessTypeRegistry(world); processTypeRegistry.register(new StatefulProcessInfo(FiveStepEmittingStatefulProcess.class, FiveStepEmittingStatefulProcess.class.getSimpleName(), exchange, statefulTypeRegistry)); }
Example 8
Source File: InMemoryJournalActor.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
public InMemoryJournalActor(final Dispatcher<Dispatchable<Entry<T>,RS>> dispatcher) { this.journal = new InMemoryJournal<>(dispatcher, stage().world()); this.entryAdapterProvider = EntryAdapterProvider.instance(stage().world()); }
Example 9
Source File: InMemoryStateStoreEntryReaderActor.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
public InMemoryStateStoreEntryReaderActor(final List<Entry<T>> entriesView, final String name) { this.entriesView = entriesView; this.name = name; this.entryAdapterProvider = EntryAdapterProvider.instance(stage().world()); this.currentIndex = 0; }
Example 10
Source File: InMemoryObjectStoreEntryReaderActor.java From vlingo-symbio with Mozilla Public License 2.0 | 4 votes |
public InMemoryObjectStoreEntryReaderActor(final List<Entry<String>> entriesView, final String name) { this.entriesView = entriesView; this.name = name; this.entryAdapterProvider = EntryAdapterProvider.instance(stage().world()); this.currentIndex = 0; }