@@ -37,6 +37,7 @@ protected async Task<Guid> PublishAsync<T>(T @event) where T : EventBase
3737 {
3838 // Create event wrapper with context propagation
3939 var eventWrapper = new EventWrapper < T > ( @event , eventId , this . GetGrainId ( ) ) ;
40+ eventWrapper . PublishedTimestampUtc = DateTime . UtcNow ;
4041 if ( State . Parent == null )
4142 {
4243 Logger . LogInformation (
@@ -66,7 +67,9 @@ private async Task PublishEventUpwardsAsync<T>(T @event, Guid eventId) where T :
6667 {
6768 try
6869 {
69- await SendEventUpwardsAsync ( new EventWrapper < T > ( @event , eventId , GrainId ) ) ;
70+ var eventWrapper = new EventWrapper < T > ( @event , eventId , GrainId ) ;
71+ eventWrapper . PublishedTimestampUtc = DateTime . UtcNow ;
72+ await SendEventUpwardsAsync ( eventWrapper ) ;
7073 Logger . LogDebug ( "{GrainId} published {Event} to upwards" , GrainId . ToString ( ) ,
7174 JsonConvert . SerializeObject ( @event ) ) ;
7275 }
@@ -94,7 +97,7 @@ private async Task SendEventUpwardsAsync<T>(EventWrapper<T> eventWrapper) where
9497 {
9598 Logger . LogError ( "{GrainId} failed to send event {EventWrapper} upwards" , GrainId . ToString ( ) ,
9699 eventWrapper ) ;
97- throw new EventPublishingException ( $ "{ GrainId . ToString ( ) } failed to event event upwards", ex ) ;
100+ throw new EventPublishingException ( $ "{ GrainId . ToString ( ) } failed to send event upwards", ex ) ;
98101 }
99102 }
100103
@@ -111,7 +114,7 @@ private async Task SendEventToSelfAsync<T>(EventWrapper<T> eventWrapper) where T
111114 {
112115 Logger . LogError ( "{GrainId} failed to send event {EventWrapper} to itself" , GrainId . ToString ( ) ,
113116 eventWrapper ) ;
114- throw new EventPublishingException ( $ "{ GrainId . ToString ( ) } failed to event event to itself", ex ) ;
117+ throw new EventPublishingException ( $ "{ GrainId . ToString ( ) } failed to send event to itself", ex ) ;
115118 }
116119 }
117120
@@ -135,7 +138,7 @@ private async Task SendEventDownwardsAsync<T>(EventWrapper<T> eventWrapper) wher
135138 {
136139 Logger . LogError ( "{GrainId} failed to send event {EventWrapper} downwards" , GrainId . ToString ( ) ,
137140 eventWrapper ) ;
138- throw new EventPublishingException ( $ "{ GrainId . ToString ( ) } failed to event event downwards", ex ) ;
141+ throw new EventPublishingException ( $ "{ GrainId . ToString ( ) } failed to send event downwards", ex ) ;
139142 }
140143 }
141144}
0 commit comments