Package org.axonframework.unitofwork

Examples of org.axonframework.unitofwork.DefaultUnitOfWorkFactory


     * @param transactionManager the TransactionManager used to manage any transactions required by the underlying
     *                           storage mechanism.
     */
    public synchronized void setTransactionManager(TransactionManager transactionManager) {
        Assert.state(disruptor == null, "Cannot set transactionManager when SagaManager has started");
        this.unitOfWorkFactory = new DefaultUnitOfWorkFactory(transactionManager);
    }
View Full Code Here


     * combination with {@link #setUnitOfWorkFactory(org.axonframework.unitofwork.UnitOfWorkFactory)}.
     *
     * @param transactionManager the transaction manager to use
     */
    public void setTransactionManager(TransactionManager transactionManager) {
        this.unitOfWorkFactory = new DefaultUnitOfWorkFactory(transactionManager);
    }
View Full Code Here

                             });
    }

    @Test
    public void testDispatchCommand_ImplicitUnitOfWorkIsCommittedOnReturnValue() {
        UnitOfWorkFactory spyUnitOfWorkFactory = spy(new DefaultUnitOfWorkFactory());
        testSubject.setUnitOfWorkFactory(spyUnitOfWorkFactory);
        testSubject.subscribe(String.class.getName(), new CommandHandler<String>() {
            @Override
            public Object handle(CommandMessage<String> command, UnitOfWork unitOfWork) throws Throwable {
                assertTrue(CurrentUnitOfWork.isStarted());
View Full Code Here

     * @param sequencingPolicy The policy indicating which events must be processed sequentially, and which may be
     *                         executed in parallel.
     */
    public AsynchronousCluster(String identifier, Executor executor,
                               SequencingPolicy<? super EventMessage<?>> sequencingPolicy) {
        this(identifier, executor, new DefaultUnitOfWorkFactory(), sequencingPolicy,
             new DefaultErrorHandler(RetryPolicy.proceed()));
    }
View Full Code Here

     * @param errorHandler       The handler that handles error during event processing
     */
    public AsynchronousCluster(String identifier, Executor executor, TransactionManager transactionManager,
                               SequencingPolicy<? super EventMessage<?>> sequencingPolicy,
                               ErrorHandler errorHandler) {
        this(identifier, executor, new DefaultUnitOfWorkFactory(transactionManager), sequencingPolicy, errorHandler);
    }
View Full Code Here

     *
     * @param executorService The backing ScheduledExecutorService
     * @param eventBus        The Event Bus on which Events are to be published
     */
    public SimpleEventScheduler(ScheduledExecutorService executorService, EventBus eventBus) {
        this(executorService, eventBus, new DefaultUnitOfWorkFactory());
    }
View Full Code Here

            eventBus = applicationContext.getBean(EventBus.class);
        }
        if (transactionManager == null) {
            this.eventScheduler = new SimpleEventScheduler(executorService, eventBus);
        } else {
            this.eventScheduler = new SimpleEventScheduler(executorService, eventBus, new DefaultUnitOfWorkFactory(
                    new SpringTransactionManager(transactionManager, transactionDefinition)));
        }
    }
View Full Code Here

     * transaction manager.
     *
     * @param transactionManager the callback to invoke before and after publication of a scheduled event
     */
    public void setTransactionManager(TransactionManager transactionManager) {
        this.unitOfWorkFactory = new DefaultUnitOfWorkFactory(transactionManager);
    }
View Full Code Here

        EventMessage<? extends StubDomainEvent> event2 = new GenericEventMessage<StubDomainEvent>(new StubDomainEvent());
        final EventListener listener = mock(EventListener.class);
        ScheduledExecutorService mockExecutorService = mock(ScheduledExecutorService.class);
        testSubject = new EventProcessor(mockExecutorService, new NullShutdownCallback(),
                                         new DefaultErrorHandler(RetryPolicy.retryAfter(500, TimeUnit.MILLISECONDS)),
                                         new DefaultUnitOfWorkFactory(mockTransactionManager),
                                         Collections.singleton(listener), multiplexingEventProcessingMonitor);

        doThrow(new MockException()).doNothing().when(listener).handle(event1);

        testSubject.scheduleEvent(event1);
View Full Code Here

        EventMessage<? extends StubDomainEvent> event2 = new GenericEventMessage<StubDomainEvent>(new StubDomainEvent());
        final EventListener listener = mock(EventListener.class);
        ExecutorService mockExecutorService = mock(ExecutorService.class);
        testSubject = new EventProcessor(mockExecutorService, new NullShutdownCallback(),
                                         new DefaultErrorHandler(RetryPolicy.retryAfter(500, TimeUnit.MILLISECONDS)),
                                         new DefaultUnitOfWorkFactory(mockTransactionManager),
                                         Collections.singleton(listener), multiplexingEventProcessingMonitor);
        doThrow(new MockException()).doNothing().when(listener).handle(event1);
        testSubject.scheduleEvent(event1);
        testSubject.scheduleEvent(event2);
        long t1 = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of org.axonframework.unitofwork.DefaultUnitOfWorkFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.