Skip to content

Add support for both attributes and message attributes #53

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Amazon.SQS/src/Extensions.SQS/Extensions.SQS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.SQS" Version="3.5.1.8" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.14" />
<PackageReference Include="AWSSDK.SQS" Version="3.5.1.21" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.25" />
Copy link
Owner

Choose a reason for hiding this comment

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

why are we updating the version of webjobs SDK? Is there a dependency on 3.0.25 for this functionality? If not, I would prefer to use as low a version as possible, so it imposes least restrictions.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, so long to respond. I'm fine with the choice of webjobs SDK. I have this running and receiving messages. It's been running for months with low message volume.

</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Azure.Functions.Extensions.SQS
{
using System;
using System.Collections.Generic;
using Microsoft.Azure.WebJobs.Description;

[Binding]
Expand All @@ -15,5 +16,11 @@ public class SqsQueueTriggerAttribute : Attribute

[AutoResolve]
public string QueueUrl { get; set; }

[AutoResolve]
public string MessageAttributeNames { get; set; }

[AutoResolve]
public string AttributeNames { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ private SqsQueueTriggerAttribute ResolveTriggerParameters(SqsQueueTriggerAttribu
AWSKeyId = this.Resolve(triggerAttribute.AWSKeyId),
AWSAccessKey = this.Resolve(triggerAttribute.AWSAccessKey),
QueueUrl = this.Resolve(triggerAttribute.QueueUrl),
MessageAttributeNames = this.Resolve(triggerAttribute.MessageAttributeNames),
AttributeNames = this.Resolve(triggerAttribute.AttributeNames)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public async Task OnTriggerCallback()
QueueUrl = this.TriggerParameters.QueueUrl,
MaxNumberOfMessages = this.SqsQueueOptions.Value.MaxNumberOfMessages.Value,
VisibilityTimeout = (int)this.SqsQueueOptions.Value.VisibilityTimeout.Value.TotalSeconds,
MessageAttributeNames = this.TriggerParameters.MessageAttributeNames?.Split(',').ToList(),
AttributeNames = this.TriggerParameters.AttributeNames?.Split(',').ToList()
};

var result = await this.AmazonSQSClient.ReceiveMessageAsync(getMessageRequest);
Expand Down