Skip to content

Include Kinesis Analytics Events#232

Merged
normj merged 2 commits intoaws:masterfrom
vlanka:master
Feb 28, 2018
Merged

Include Kinesis Analytics Events#232
normj merged 2 commits intoaws:masterfrom
vlanka:master

Conversation

@vlanka
Copy link
Copy Markdown
Contributor

@vlanka vlanka commented Feb 22, 2018

Including Kinesis Analytics events and response models with tests.

Copy link
Copy Markdown
Member

@normj normj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple comments to take care of and then we can get this shipped.

/// The approximate arrival timestamp.
/// </value>
[DataMember(Name = "approximateArrivalTimestamp")]
public long ApproximateArrivalTimestamp { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning longs for dates in .NET makes it hard to use. Users have to understand that it is an Epoch and figure out how to convert from Epoch to DateTime.

We should do what we did for the KinesisFirehoseEvent and rename this property to ApproximateArrivalEpoch and then provide a second read only property called ApproximateArrivalTimestamp that converts the Epoch property to DateTime. Here is the code on how we did this before.

https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.KinesisFirehoseEvents/KinesisFirehoseEvent.cs#L50-L66

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be cleaner to have the property of the dto of type DateTimeOffset and use a JsonConverter responsible for converting to/from Unix epoch?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try in the event POCOs to not have anything specific to Newtonsoft in case we want to swap out the serializer in the future. That is why we use the DataContracts attributes instead of Newtonsoft's attributes.

You are probably right that I should have used DateTimeOffset when creating the KinesisFirehoseEvent but changing now would be breaking and since this is basically the same property I would prefer to be consistent with that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

/// The approximate arrival timestamp.
/// </value>
[DataMember(Name = "approximateArrivalTimestamp")]
public long ApproximateArrivalTimestamp { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before about return dates as long

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

public class LambdaDeliveryRecordMetadata
{
/// <summary>
/// Gets or sets the retry hint.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add documentation that says retry hints are the number of delivery retries. Otherwise it is a confusing property.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

@normj normj merged commit 2c9d49b into aws:master Feb 28, 2018
@normj
Copy link
Copy Markdown
Member

normj commented Feb 28, 2018

All merged and NuGet package released https://www.nuget.org/packages/Amazon.Lambda.KinesisAnalyticsEvents/. Thanks for the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants