-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #740 from paolosalvatori/event-hubs-investigation
Abstracting EventHubs EventData
- Loading branch information
Showing
8 changed files
with
193 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
namespace ServiceBusExplorer.Abstractions | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Microsoft.Azure.Amqp; | ||
using Microsoft.ServiceBus.Messaging; | ||
|
||
public class EventDataMessage : IDisposable | ||
{ | ||
readonly EventData eventData; | ||
Stream stream; | ||
|
||
public EventDataMessage(EventData eventData) | ||
{ | ||
this.eventData = eventData; | ||
stream = eventData.GetBodyStream(); | ||
Properties = eventData.Properties; | ||
PartitionKey = eventData.PartitionKey; | ||
SequenceNumber = eventData.SequenceNumber; | ||
Offset = eventData.Offset; | ||
SerializedSizeInBytes = eventData.SerializedSizeInBytes; | ||
EnqueuedTimeUtc = eventData.EnqueuedTimeUtc; | ||
SystemProperties = eventData.SystemProperties; | ||
} | ||
|
||
public string PartitionKey { get; private set; } | ||
public long SequenceNumber { get; private set; } | ||
public long SerializedSizeInBytes { get; private set; } | ||
public string Offset { get; private set; } | ||
public DateTime EnqueuedTimeUtc { get; private set; } | ||
public IDictionary<string, object> Properties { get; private set; } | ||
public IDictionary<string, object> SystemProperties { get; private set; } | ||
|
||
public Stream GetBodyStream() | ||
{ | ||
var memoryStream = new MemoryStream(); | ||
|
||
stream.CopyTo(memoryStream); | ||
stream.Seek(0L, SeekOrigin.Begin); | ||
|
||
return memoryStream; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
eventData.Dispose(); | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.