It is also possible to define your messages simply using classes and not have the additional complexity of schemas. In order to use a class first message you would create a normal style .net type but you need to add the DataContract and Serializable attributes to the class.

The DataContract attribute should also have the Name and Namespace properties specified like in the below example.

    [System.Runtime.Serialization.DataContractAttribute(Name="OneWaySuccessMessage",     Namespace="http://appfx/servicebus/contracts/diagnostics/v1.0")]
    public partial class TestMessage
        public string MessageID
            get; set;

The importance of the Name and Namespace properties is that they are used to create the "Message Type" property which us used to communicate to other applications which type of data they have been sent.

Once you have defined your class as above you will be able to use the AppFx.ServiceBus framework to work with this message. You will need to ensure that you have communicated to anyone who will send data to you or get data from you what the data structure and message type will be so they can follow a similar approach. Alternatively you could also share the class or dll containing the message definition.

Last edited Apr 6, 2014 at 1:46 AM by michaelstephenson, version 1


No comments yet.