Skip to content
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

Amqp updates #14681

Merged
merged 6 commits into from
Aug 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,57 @@ public void AppendTest(string path, string rawJsonValue) { }
public override string ToString() { throw null; }
}
}
namespace Azure.Core.Amqp
{
public partial class AmqpAnnotatedMessage
{
public AmqpAnnotatedMessage(Azure.Core.Amqp.AmqpAnnotatedMessage message) { }
public AmqpAnnotatedMessage(System.Collections.Generic.IEnumerable<Azure.BinaryData> dataBody) { }
public System.Collections.Generic.IDictionary<string, object> ApplicationProperties { get { throw null; } set { } }
public Azure.Core.Amqp.AmqpMessageBody Body { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, object> DeliveryAnnotations { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, object> Footer { get { throw null; } set { } }
public Azure.Core.Amqp.AmqpMessageHeader Header { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, object> MessageAnnotations { get { throw null; } set { } }
public Azure.Core.Amqp.AmqpMessageProperties Properties { get { throw null; } set { } }
}
public partial class AmqpDataBody : Azure.Core.Amqp.AmqpMessageBody
{
public AmqpDataBody(System.Collections.Generic.IEnumerable<Azure.BinaryData> data) { }
public System.Collections.Generic.IEnumerable<Azure.BinaryData> Data { get { throw null; } }
}
public abstract partial class AmqpMessageBody
{
protected AmqpMessageBody() { }
}
public partial class AmqpMessageHeader
{
public AmqpMessageHeader() { }
public uint? DeliveryCount { get { throw null; } set { } }
public bool? Durable { get { throw null; } set { } }
public bool? FirstAcquirer { get { throw null; } set { } }
public byte? Priority { get { throw null; } set { } }
public System.TimeSpan? TimeToLive { get { throw null; } set { } }
}
public partial class AmqpMessageProperties
{
public AmqpMessageProperties() { }
public AmqpMessageProperties(Azure.Core.Amqp.AmqpMessageProperties properties) { }
public System.DateTime? AbsoluteExpiryTime { get { throw null; } set { } }
public string? ContentEncoding { get { throw null; } set { } }
public string? ContentType { get { throw null; } set { } }
public string? CorrelationId { get { throw null; } set { } }
public System.DateTime? CreationTime { get { throw null; } set { } }
public string? GroupId { get { throw null; } set { } }
public uint? GroupSequence { get { throw null; } set { } }
public string? MessageId { get { throw null; } set { } }
public string? ReplyTo { get { throw null; } set { } }
public string? ReplyToGroupId { get { throw null; } set { } }
public string? Subject { get { throw null; } set { } }
public string? To { get { throw null; } set { } }
public Azure.BinaryData? UserId { get { throw null; } set { } }
}
}
namespace Azure.Core.GeoJson
{
public sealed partial class GeoBoundingBox : System.IEquatable<Azure.Core.GeoJson.GeoBoundingBox>
Expand Down
75 changes: 75 additions & 0 deletions sdk/core/Azure.Core.Experimental/src/Amqp/AmqpAnnotatedMessage.cs
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.
/// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format" />
/// </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 sections comprising the message body.
/// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-data"/>
/// </param>
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; }
}
}
30 changes: 30 additions & 0 deletions sdk/core/Azure.Core.Experimental/src/Amqp/AmqpDataBody.cs
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.
/// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-data" />
/// </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 sdk/core/Azure.Core.Experimental/src/Amqp/AmqpMessageBody.cs
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.
/// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format" />
/// </summary>
public abstract class AmqpMessageBody
{
}
}
58 changes: 58 additions & 0 deletions sdk/core/Azure.Core.Experimental/src/Amqp/AmqpMessageHeader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;

namespace Azure.Core.Amqp
{
/// <summary>
/// Represents an AMQP message transport header.
/// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header" />
/// </summary>
public class AmqpMessageHeader
{
/// <summary>
/// Initializes a new <see cref="AmqpMessageHeader"/> instance.
/// </summary>
public AmqpMessageHeader() { }

/// <summary>
/// Initializes a new <see cref="AmqpMessageHeader"/> instance by copying the passed in
/// AMQP message transport header.
/// </summary>
/// <param name="header">The AMQP message transport header to copy.</param>
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 transport header.
/// </summary>
public bool? Durable { get; set; }

/// <summary>
/// The priority value from the AMQP message transport header.
/// </summary>
public byte? Priority { get; set; }

/// <summary>
/// The ttl value from the AMQP message transport header.
/// </summary>
public TimeSpan? TimeToLive { get; set; }

/// <summary>
/// The first-acquirer value from the AMQP message transport header.
/// </summary>
public bool? FirstAcquirer { get; set; }

/// <summary>
/// The delivery-count value from the AMQP message transport header.
/// </summary>
public uint? DeliveryCount { get; set; }
}
}
105 changes: 105 additions & 0 deletions sdk/core/Azure.Core.Experimental/src/Amqp/AmqpMessageProperties.cs
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.
/// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties" />
/// </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">The properties to copy.</param>
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; }
}
}
Loading