eventuate-tram-sagas
eventuate-tram-sagas copied to clipboard
Eventuate sagas not well described
I tried to start basic saga - but i did not find how to start it. In documentation: https://eventuate.io/docs/manual/eventuate-tram/latest/getting-started-eventuate-tram-sagas.html#getting-started-tram-sagas
I see:
Creating an saga orchestrator
The OrderService creates the saga:
public class OrderService {
@Autowired private SagaManager<CreateOrderSagaData> createOrderSagaManager;
@Autowired private OrderRepository orderRepository;
@Transactional public Order createOrder(OrderDetails orderDetails) { ResultWithEvents<Order> oe = Order.createOrder(orderDetails); Order order = oe.result; orderRepository.save(order); CreateOrderSagaData data = new CreateOrderSagaData(order.getId(), orderDetails); createOrderSagaManager.create(data, Order.class, order.getId()); return order; } }
But i only wanted to create saga, so i need to use
createOrderSagaManager.create(data);
?
Why it is not described in documentation?
I am wondering what this code actually do - i can not find any information in the documentation.
Can i start Saga with passing some DTO wihout these lines:
ResultWithEvents<Order> oe = Order.createOrder(orderDetails);
Order order = oe.result;
orderRepository.save(order);
? Can you add video when you tell how this framework work line by line?
And this:
@Autowired private SagaManager<CreateOrderSagaData> createOrderSagaManager;
From where is this createOrderSagaManager injected?
Hi~! There should be a @Configuration class configured with this @Bean, You may need to use SagaInstanceFactory , It is more intuitive.
this.sagaInstanceFactory.create( this.bizSaga, new BizSagaData( required biz params...));