RawRabbit
RawRabbit copied to clipboard
PublishAsync fails with PublishConfirmException if anonymous type is used
Sample code:
` [DataContract] public class EmailRequest { [DataMember] public string UserId { get; set; }
[DataMember]
public string TemplateName { get; set; }
[DataMember]
public Dictionary<string, object> Variables { get; set; }
}
{
var message = new EmailRequest()
{
UserId = userId,
TemplateName = templateName,
Variables = new Dictionary<string, object>()
{
{"id", calculationId},
{"calculation", calculationName}
}
};
await _busClient.PublishAsync(message, ctx => ctx
.UsePublishConfiguration(cfg => cfg
.WithRoutingKey("email.send")
.OnExchange("fastgenomics")));`
This will work, but using this fails with a PublishConfirmException:
` { var message = new { UserId = userId, TemplateName = templateName, Variables = new Dictionary<string, object>() { {"id", calculationId}, {"calculation", calculationName} } };
await _busClient.PublishAsync(message, ctx => ctx
.UsePublishConfiguration(cfg => cfg
.WithRoutingKey("email.send")
.OnExchange("fastgenomics")));`
Thanks for reporting this. I wonder if there is something else going wrong causing the exception to be thrown. Could you try to do the same, but make sure that the exchange fastgenomics isn't declared? It would also be helpful if you could create a unit test that demonstrates the issue. Thanks!