We are converting an app from using MSMQ to Azure Service Bus. We have an object (message, type of) that looks like this:
[Serializable]
public class LeadSubmissionMessage
{
public long LeadId { get; set; }
public long UserId { get; set; }
public DateTime DateTime { get; set; }
}
In creating a BrokeredMessage from the object, at first I figured it was working because it compiled and didn't throw a runtime error, but then no messages were showing up in the service bus. So when I watched it in debug, I realized it's not actually serializing the object.
BrokeredMessage brokeredMessage = new BrokeredMessage(message);
In looking at other similar posts, I tried this:
BrokeredMessage brokeredMessage = new BrokeredMessage(message, new DataContractSerializer(typeof(LeadSubmissionMessage)));
But that gets the same result.
What do I need to do so that the object actually becomes an xml string that is submitted to the message?
EDIT:
Tried this too. Same result:
[DataContract]
[Serializable]
public class LeadSubmissionMessage
{
[DataMember]
public long LeadId { get; set; }
[DataMember]
public long UserId { get; set; }
[DataMember]
public DateTime DateTime { get; set; }
}