I have mock azure web jobs, which periodically push BrokeredMessage
to the service bus topic, like this
public void Simulate(
[TimerTrigger("0 */30 * * * *", RunOnStartup = true)]
TimerInfo timerInfo,
[ServiceBus("%topic%")]
out BrokeredMessage message)
{
message = new BrokeredMessage(
new AwesomeContract()
{
});
}
In azure function V2, I am trying to consume it using Message
class.
public static void Integrate(
[ServiceBusTrigger(
"%topic%",
"%subscribtion%",
Connection = "ServiceBusConnection")] Message message,
TraceWriter log,
ExecutionContext context)
{
try
{
message.GetBody<AwesomeContract>();
}
}
On GetBody<>
I receive DataContractSerialization
exception "There was an error deserializing the object of type . The input source is not correctly formatted."
Are BrokeredMessage
and Message
compatible in azure function v1 and v2? Any suggestions?