I have a service bus queue item BrokeredMessage with the following body:
{"MemberId":711918,"CampaignId":"214ade86-9167-40ba-a63a-9eeb57f893fa"}
The method looks like this:
public static async Task Run(BrokeredMessage myQueueItem, CampaignResult inputDocument, TraceWriter log)
I want to see if the function can pull a document from cosmodb/documentdb with the bindings like this:
"bindings": [
{
"name": "myQueueItem",
"type": "serviceBusTrigger",
"direction": "in",
"queueName": "myqueue",
"connection": "myconnectionsb",
"accessRights": "Manage"
},
{
"type": "documentDB",
"name": "inputDocument",
"databaseName": "pmg-docdb-rd-test",
"collectionName": "JobResults",
"id": "{CampaignId}-{MemberId}",
"connection": "myconnection",
"direction": "in"
}
],
I can't seem to pull it all together. Also, I'm not sure what will actually happen if the document doesn't exist, I would expect the inputDocument to be null but I'm not sure, the idea is I'd like to create it if it doesn't exist and make updates if it does. Since the docs say the any changes to the input document will be persisted I think the updates will work....
The error is: No value for named parameter CampaignId
In Summary, can I have the function retrieve a cosmodb document based on the message and if the document is null it gets created otherwise changes are persisted?
Edit: Just realized that the docdb/cosmodb returns a 404 not found if the document doesn't exist and that I don't think there are any input binding for service bus queue messages, yet.....