Reputation: 5977
According to this WebJobs documentation page, for POCO output queue messages, "A queue message is always created, even if the object is null."
In my scenario, I only want to conditionally output queue messages from my WebJob. Currently I am getting a ton of null messages to my downstream WebJob using the "out" queue:
[Queue("myoutqueue")] out myPOCO outputQueueMessage
Is the only way to do this to not use the WebJobs Queue attribute and to queue the message myself using the client library?
Upvotes: 0
Views: 177
Reputation: 13568
You can conditionally enqueue an output message by using the ICollector<T>
binding. For example:
[Queue("myoutqueue")] ICollector<MyPoco> outMessages
Then, only messages added to the collector via outMessages.Add(message)
will be sent (one or more). More on ICollector<T>
and other Queue bindings can be found here.
Upvotes: 5