I try to make this more readable, but I am not sure if gmail will foobar the
formatting or not

        public OrderSaga(IServiceBus bus, IQuery<Order> orders)
            : base(bus, orders)
        {
            _bus = bus;
            if (_orderId > 0)
                State = Query.Get(_orderId);
        }

        #region InitiatedBy<StartOrderSaga> Members

        public void Consume(StartOrderSaga message)
        {
            // the order is already persisted, so we don't care for
that right now
            _bus.DelaySend(DateTime.Now.Add(_timeToWaitForPayment),
new CheckOrderWasPaid
                                                                        {

     OrderId = message.OrderId,

     CorrelationId = Id
                                                                        });
            _orderId = message.OrderId;
            _bus.Send(new OrderCreated {OrderId = message.OrderId});
            State.State = OrderStates.New;
        }

        #endregion



On Fri, May 21, 2010 at 9:10 AM, Jan Limpens <[email protected]> wrote:
> Would that be a good approach?
>
>        public OrderSaga(IServiceBus bus, IQuery<Order> orders)
>            : base(bus, orders)
>        {
>            _bus = bus;
>            if (_orderId > 0)
>                State = orders.Get(_orderId);
>        }
>
>        #region InitiatedBy<StartOrderSaga> Members
>
>        public void Consume(StartOrderSaga message)
>        {
>            // the order is already persisted, so we don't care for
> that right now
>            _bus.DelaySend(DateTime.Now.Add(_timeToWaitForPayment),
> new CheckOrderWasPaid
>                                                                        {
>
>     OrderId = message.OrderId,
>
>     CorrelationId = Id
>                                                                        });
>            _orderId = message.OrderId;
>            _bus.Send(new OrderCreated {OrderId = message.OrderId});
>            State.State = OrderStates.New;
>        }
>
>        #endregion
>
> On Fri, May 21, 2010 at 8:58 AM, Jan Limpens <[email protected]>
wrote:
>> On Fri, May 21, 2010 at 4:44 AM, Ayende Rahien <[email protected]> wrote:
>>> inline
>>> It may send messages such as:
>>> NotifyUserAboutSuccessfulOrder, NotifyUserAboutDeclinedCreditCard
>>> RefreshLostSalesReport, RefreshTotalMoneyMadeRport
>>
>> That's interesting how you send very implementation detailed messages
>> there. I had thought one would send, following your examples, a
>> SuccessFullOrderMessage and have multiple subscribers / services to
>> it, like a WhenOrderWasSuccessful.RefreshTotalMoneyMadeReportService
>> and a WhenOrderWasSuccessful.NotifyUserWithEmailService. This would
>> allow to plug in and out actions without touching the actual work
>> flow.
>> What's the reason(ing) behind this?
>>
>> Are there any examples around, that you would know of, showing how to
>> link an entity to a Saga? Never did that before and there might be
>> common pit falls.
>>
>> Thanks!
>>
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to