--
You received this message because you are subscribed to the Google Groups "Event Store" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-store...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public OrderPlaced(Guid correlationId, Guid commandId, Guid orderId, Guid accountId, int actionCode)
: base(correlationId, commandId)
Where the causationId is of course the commandId.
Why are they part of the event as opposed to metadata associared with the event?
--
You received this message because you are subscribed to the Google Groups "Event Store" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-store...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Maybe common domain is the problem.
You shouldnt put such things in event body they dont belong there
I want to keep that metadata with the event throughout the entire domain. If I store them in the aggregate as envelopes, they become - with current implementation of CommonDomain eventstore repository - the body of the ES event, i.e. including the metadata. I can of course modify that repository implementation easily, and remove the update headers action from the parameter list, and instead extract the headers from the envelopes I get when calling aggregate.GetUncommitedEvents(), and also extract the clean event from the envelope, for saving in ES. (Still looking for how to use that update headers action passed as parameter anyway)
--
if (envelope.CorrelationId != null)
{
if (string.CompareOrdinal(this.SeatReservationCommandId.ToString(), envelope.CorrelationId) != 0)
{
// skip this event
Trace.TraceWarning("Seat reservation response for reservation id {0} does not match the expected correlation id.", envelope.Body.ReservationId);
return;
}
}
--
You received this message because you are subscribed to the Google Groups "Event Store" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-store...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
They are separate patterns and you hse both of them.
But just always copy correlation id correlation id is never commands message id
public void OpenAccount(Guid correlationId, Guid commandId, Guid accountId, Guid ownerId)
{
if (_opened) // or some other sort of validation
throw new InvalidOperationException("Account already opened");
ApplyEvent(new NewAccountOpened(correlationId, commandId, accountId, ownerId));
}
protected virtual void Apply(dynamic e) { }
public void ApplyEvent(object @event)
{
((dynamic)this).Apply(@event);
_uncommittedEvents.Add(@event);
this._version++;
}
public void OpenAccount(Envelope<ICommand> envelope)
{
if (_opened) // or some other sort of validation
throw new InvalidOperationException("Account already opened");
var command = envelope.Body;
if (envelope.Body.GetType() == typeof(OpenNewAccount))
{
var @event = new NewAccountOpened(command.AccountId, command.OwnerId));
var eventEnvelope = Envelope.ForEvent(@event, envelope.CorrelationId, command.Id);
ApplyEvent(eventEnvelope);
}
else
throw new ArgumentException("Wrong command type");
}
public void ApplyEvent(Envelope<IDomainEvent> envelope)
{
((dynamic)this).Apply(envelope.Body);
_uncommittedEvents.Add(envelope);
this._version++;
}
Why not use a "context" plus a unit od work. The aggregate doesnt need the envelope.
Doing headers by context is hard when using aggregates the way they
work in your example. With a UOW its trivial. Just use the UOW and
your problem goes away.