-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Amqp updates #14681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Amqp updates #14681
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
457a223
Include more AMQP details in message
JoshLove-msft a52952c
Export api
JoshLove-msft 078d6c8
PR feedback
JoshLove-msft 0380574
Update doc
JoshLove-msft 16694a4
Improve multi data section
JoshLove-msft d9eff17
Fix bug caused by lazy enumeration of message body
JoshLove-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
75 changes: 75 additions & 0 deletions
75
sdk/core/Azure.Core.Experimental/src/Amqp/AmqpAnnotatedMessage.cs
This file contains hidden or 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,75 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Collections.Generic; | ||
|
|
||
| namespace Azure.Core.Amqp | ||
| { | ||
| /// <summary> | ||
| /// Represents an AMQP message. | ||
| /// http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public class AmqpAnnotatedMessage | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new <see cref="AmqpAnnotatedMessage"/> instance by copying the passed in message. | ||
| /// </summary> | ||
| /// <param name="message">The message to copy.</param> | ||
| public AmqpAnnotatedMessage(AmqpAnnotatedMessage message) | ||
| { | ||
| Body = message.Body; | ||
| ApplicationProperties = new Dictionary<string, object>(message.ApplicationProperties); | ||
| Properties = new AmqpMessageProperties(message.Properties); | ||
| MessageAnnotations = new Dictionary<string, object>(message.MessageAnnotations); | ||
| DeliveryAnnotations = new Dictionary<string, object>(message.DeliveryAnnotations); | ||
| Footer = new Dictionary<string, object>(message.Footer); | ||
| Header = new AmqpMessageHeader(message.Header); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Creates a new Data body <see cref="AmqpAnnotatedMessage"/>. | ||
| /// </summary> | ||
| /// <param name="dataBody">The data body sections.</param> | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public AmqpAnnotatedMessage(IEnumerable<BinaryData> dataBody) | ||
| { | ||
| Body = new AmqpDataBody(dataBody); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The header of the AMQP message. | ||
| /// </summary> | ||
| public AmqpMessageHeader Header { get; set; } = new AmqpMessageHeader(); | ||
|
|
||
| /// <summary> | ||
| /// The footer of the AMQP message. | ||
| /// </summary> | ||
| public IDictionary<string, object> Footer { get; set; } = new Dictionary<string, object>(); | ||
|
|
||
| /// <summary> | ||
| /// The delivery annotations of the AMQP message. | ||
| /// </summary> | ||
| public IDictionary<string, object> DeliveryAnnotations { get; set; } = new Dictionary<string, object>(); | ||
|
|
||
| /// <summary> | ||
| /// The message annotations of the AMQP message. | ||
| /// </summary> | ||
| public IDictionary<string, object> MessageAnnotations { get; set; } = new Dictionary<string, object>(); | ||
|
|
||
| /// <summary> | ||
| /// The properties of the AMQP message. | ||
| /// </summary> | ||
| public AmqpMessageProperties Properties { get; set; } = new AmqpMessageProperties(); | ||
|
|
||
| /// <summary> | ||
| /// The application properties of the AMQP message. | ||
| /// </summary> | ||
| public IDictionary<string, object> ApplicationProperties { get; set; } = new Dictionary<string, object>(); | ||
|
|
||
| /// <summary> | ||
| /// The body of the AMQP message. | ||
| /// </summary> | ||
| public AmqpMessageBody Body { get; set; } | ||
|
|
||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| } | ||
| } | ||
This file contains hidden or 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,30 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Collections.Generic; | ||
|
|
||
| namespace Azure.Core.Amqp | ||
| { | ||
| /// <summary> | ||
| /// Represents the data body of an AMQP message. | ||
| /// This consists of one or more data sections. | ||
| /// http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-data | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public class AmqpDataBody : AmqpMessageBody | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new <see cref="AmqpDataBody"/> instance with the | ||
| /// passed in data sections. | ||
| /// </summary> | ||
| /// <param name="data">The data sections.</param> | ||
| public AmqpDataBody(IEnumerable<BinaryData> data) | ||
| { | ||
| Data = data; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The data sections for the AMQP message body. | ||
| /// </summary> | ||
| public IEnumerable<BinaryData> Data { get; internal set; } | ||
| } | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
sdk/core/Azure.Core.Experimental/src/Amqp/AmqpMessageBody.cs
This file contains hidden or 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,13 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Azure.Core.Amqp | ||
| { | ||
| /// <summary> | ||
| /// Represents an AMQP message body. | ||
| /// http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public abstract class AmqpMessageBody | ||
| { | ||
| } | ||
| } | ||
54 changes: 54 additions & 0 deletions
54
sdk/core/Azure.Core.Experimental/src/Amqp/AmqpMessageHeader.cs
This file contains hidden or 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,54 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Azure.Core.Amqp | ||
| { | ||
| /// <summary> | ||
| /// Represents an AMQP message header. | ||
| /// http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public class AmqpMessageHeader | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new <see cref="AmqpMessageHeader"/> instance. | ||
| /// </summary> | ||
| public AmqpMessageHeader() { } | ||
|
|
||
| internal AmqpMessageHeader(AmqpMessageHeader header) | ||
JoshLove-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| Durable = header.Durable; | ||
| Priority = header.Priority; | ||
| TimeToLive = header.TimeToLive; | ||
| FirstAcquirer = header.FirstAcquirer; | ||
| DeliveryCount = header.DeliveryCount; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The durable value from the AMQP message header. | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public bool? Durable { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The priority value from the AMQP message header. | ||
| /// </summary> | ||
| public byte? Priority { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The ttl value from the AMQP message header. | ||
| /// </summary> | ||
| public TimeSpan? TimeToLive { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The first-acquirer value from the AMQP message header. | ||
| /// </summary> | ||
| public bool? FirstAcquirer { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The delivery-count value from the AMQP message header. | ||
| /// </summary> | ||
| public uint? DeliveryCount { get; set; } | ||
|
|
||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
105 changes: 105 additions & 0 deletions
105
sdk/core/Azure.Core.Experimental/src/Amqp/AmqpMessageProperties.cs
This file contains hidden or 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,105 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Azure.Core.Amqp | ||
| { | ||
| /// <summary> | ||
| /// Represents the AMQP message properties. | ||
| /// http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public class AmqpMessageProperties | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new <see cref="AmqpMessageProperties"/> instance. | ||
| /// </summary> | ||
| public AmqpMessageProperties() { } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new <see cref="AmqpMessageProperties"/> instance by copying the passed in properties. | ||
| /// </summary> | ||
| /// <param name="properties"></param> | ||
JoshLove-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public AmqpMessageProperties(AmqpMessageProperties properties) | ||
| { | ||
| MessageId = properties.MessageId; | ||
| UserId = properties.UserId; | ||
| To = properties.To; | ||
| Subject = properties.Subject; | ||
| ReplyTo = properties.ReplyTo; | ||
| CorrelationId = properties.CorrelationId; | ||
| ContentType = properties.ContentType; | ||
| ContentEncoding = properties.ContentEncoding; | ||
| AbsoluteExpiryTime = properties.AbsoluteExpiryTime; | ||
| CreationTime = properties.CreationTime; | ||
| GroupId = properties.GroupId; | ||
| GroupSequence = properties.GroupSequence; | ||
| ReplyToGroupId = properties.ReplyToGroupId; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The message-id value from the AMQP properties. | ||
| /// </summary> | ||
| public string? MessageId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The user-id value from the AMQP properties. | ||
| /// </summary> | ||
| public BinaryData? UserId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The to value from the AMQP properties. | ||
| /// </summary> | ||
| public string? To { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The subject value from the AMQP properties. | ||
| /// </summary> | ||
| public string? Subject { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The reply-to value from the AMQP properties. | ||
| /// </summary> | ||
| public string? ReplyTo { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The correlation-id value from the AMQP properties. | ||
| /// </summary> | ||
| public string? CorrelationId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The content-type value from the AMQP properties. | ||
| /// </summary> | ||
| public string? ContentType { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The content-encoding value from the AMQP properties. | ||
| /// </summary> | ||
| public string? ContentEncoding { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The absolute-expiry-time value from the AMQP properties. | ||
| /// </summary> | ||
| public DateTime? AbsoluteExpiryTime { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The creation-time value from the AMQP properties. | ||
| /// </summary> | ||
| public DateTime? CreationTime { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The group-id value from the AMQP properties. | ||
| /// </summary> | ||
| public string? GroupId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The group-sequence value from the AMQP properties. | ||
| /// </summary> | ||
| public uint? GroupSequence { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The reply-to-group-id value from the AMQP properties. | ||
| /// </summary> | ||
| public string? ReplyToGroupId { get; set; } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.