mirror of https://github.com/abpframework/abp.git
10 changed files with 232 additions and 1 deletions
@ -0,0 +1,36 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public class DbContextEventInbox<TDbContext> : IDbContextEventInbox<TDbContext> |
||||
|
where TDbContext : IHasEventInbox |
||||
|
{ |
||||
|
public Task EnqueueAsync(IncomingEventInfo incomingEvent) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task<List<IncomingEventInfo>> GetWaitingEventsAsync(int maxCount) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task MarkAsProcessedAsync(Guid id) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task<bool> ExistsByMessageIdAsync(string messageId) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task DeleteOldEventsAsync() |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
using Volo.Abp.Uow; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public class DbContextEventOutbox<TDbContext> : IDbContextEventOutbox<TDbContext> |
||||
|
where TDbContext : IHasEventOutbox |
||||
|
{ |
||||
|
public Task EnqueueAsync(OutgoingEventInfo outgoingEvent) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task<List<OutgoingEventInfo>> GetWaitingEventsAsync(int maxCount) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public interface IDbContextEventInbox<TDbContext> : IEventInbox |
||||
|
where TDbContext : IHasEventInbox |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public interface IDbContextEventOutbox<TDbContext> : IEventOutbox |
||||
|
where TDbContext : IHasEventOutbox |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using MongoDB.Driver; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public interface IHasEventInbox : IAbpMongoDbContext |
||||
|
{ |
||||
|
IMongoCollection<IncomingEventRecord> IncomingEvents { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using MongoDB.Driver; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public interface IHasEventOutbox : IAbpMongoDbContext |
||||
|
{ |
||||
|
IMongoCollection<OutgoingEventRecord> OutgoingEvents { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,66 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Auditing; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public class IncomingEventRecord : |
||||
|
BasicAggregateRoot<Guid>, |
||||
|
IHasExtraProperties, |
||||
|
IHasCreationTime |
||||
|
{ |
||||
|
public static int MaxEventNameLength { get; set; } = 256; |
||||
|
|
||||
|
public ExtraPropertyDictionary ExtraProperties { get; private set; } |
||||
|
|
||||
|
public string MessageId { get; private set; } |
||||
|
|
||||
|
public string EventName { get; private set; } |
||||
|
|
||||
|
public byte[] EventData { get; private set; } |
||||
|
|
||||
|
public DateTime CreationTime { get; private set; } |
||||
|
|
||||
|
public bool Processed { get; set; } |
||||
|
|
||||
|
public DateTime? ProcessedTime { get; set; } |
||||
|
|
||||
|
protected IncomingEventRecord() |
||||
|
{ |
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
|
||||
|
public IncomingEventRecord( |
||||
|
IncomingEventInfo eventInfo) |
||||
|
: base(eventInfo.Id) |
||||
|
{ |
||||
|
MessageId = eventInfo.MessageId; |
||||
|
EventName = eventInfo.EventName; |
||||
|
EventData = eventInfo.EventData; |
||||
|
CreationTime = eventInfo.CreationTime; |
||||
|
|
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
|
||||
|
public IncomingEventInfo ToIncomingEventInfo() |
||||
|
{ |
||||
|
return new IncomingEventInfo( |
||||
|
Id, |
||||
|
MessageId, |
||||
|
EventName, |
||||
|
EventData, |
||||
|
CreationTime |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
public void MarkAsProcessed(DateTime processedTime) |
||||
|
{ |
||||
|
Processed = true; |
||||
|
ProcessedTime = processedTime; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Auditing; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace Volo.Abp.MongoDB.DistributedEvents |
||||
|
{ |
||||
|
public class OutgoingEventRecord : |
||||
|
BasicAggregateRoot<Guid>, |
||||
|
IHasExtraProperties, |
||||
|
IHasCreationTime |
||||
|
{ |
||||
|
public static int MaxEventNameLength { get; set; } = 256; |
||||
|
|
||||
|
public ExtraPropertyDictionary ExtraProperties { get; private set; } |
||||
|
|
||||
|
public string EventName { get; private set; } |
||||
|
|
||||
|
public byte[] EventData { get; private set; } |
||||
|
|
||||
|
public DateTime CreationTime { get; private set; } |
||||
|
|
||||
|
protected OutgoingEventRecord() |
||||
|
{ |
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
|
||||
|
public OutgoingEventRecord( |
||||
|
OutgoingEventInfo eventInfo) |
||||
|
: base(eventInfo.Id) |
||||
|
{ |
||||
|
EventName = eventInfo.EventName; |
||||
|
EventData = eventInfo.EventData; |
||||
|
CreationTime = eventInfo.CreationTime; |
||||
|
|
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
|
||||
|
public OutgoingEventInfo ToOutgoingEventInfo() |
||||
|
{ |
||||
|
return new OutgoingEventInfo( |
||||
|
Id, |
||||
|
EventName, |
||||
|
EventData, |
||||
|
CreationTime |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue