Browse Source

Merge pull request #11250 from abpframework/auto-merge/rel-5-0/774

Merge branch dev with rel-5.0
pull/11254/head
liangshiwei 4 years ago
committed by GitHub
parent
commit
afc99acdb9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs

17
framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs

@ -87,7 +87,7 @@ public class AzureDistributedEventBus : DistributedEventBusBase, ISingletonDepen
public override async Task PublishFromOutboxAsync(OutgoingEventInfo outgoingEvent, OutboxConfig outboxConfig)
{
await PublishAsync(outgoingEvent.EventName, outgoingEvent.EventData);
await PublishAsync(outgoingEvent.EventName, outgoingEvent.EventData, outgoingEvent.Id);
}
public override async Task ProcessFromInboxAsync(IncomingEventInfo incomingEvent, InboxConfig inboxConfig)
@ -188,15 +188,28 @@ public class AzureDistributedEventBus : DistributedEventBusBase, ISingletonDepen
unitOfWork.AddOrReplaceDistributedEvent(eventRecord);
}
protected virtual async Task PublishAsync(string eventName, object eventData)
protected virtual Task PublishAsync(string eventName, object eventData)
{
var body = _serializer.Serialize(eventData);
return PublishAsync(eventName, body, null);
}
protected virtual async Task PublishAsync(
string eventName,
byte[] body,
Guid? eventId)
{
var message = new ServiceBusMessage(body)
{
Subject = eventName
};
if (message.MessageId.IsNullOrWhiteSpace())
{
message.MessageId = (eventId ?? GuidGenerator.Create()).ToString("N");
}
var publisher = await _publisherPool.GetAsync(
_options.TopicName,
_options.ConnectionName);

Loading…
Cancel
Save