Apache.NMS.ActiveMQ.Commands.ActiveMQMessage.BeforeMarshall C# (CSharp) Method

BeforeMarshall() public method

public BeforeMarshall ( OpenWireFormat wireFormat ) : void
wireFormat Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat
return void
        public override void BeforeMarshall(OpenWireFormat wireFormat)
        {
            MarshalledProperties = null;
            if(properties != null)
            {
                MarshalledProperties = properties.Marshal();
            }
        }

Usage Example

        public void TestConvertProperties()
        {
            ActiveMQMessage msg = new ActiveMQMessage();

            msg.Properties["stringProperty"] = "string";
            msg.Properties["byteProperty"] = (Byte) 1;
            msg.Properties["shortProperty"] = (Int16) 1;
            msg.Properties["intProperty"] = (Int32) 1;
            msg.Properties["longProperty"] = (Int64) 1;
            msg.Properties["floatProperty"] = (Single) 1.1f;
            msg.Properties["doubleProperty"] = (Double) 1.1;
            msg.Properties["booleanProperty"] = (Boolean) true;
            msg.Properties["nullProperty"] = null;

            msg.BeforeMarshall(new OpenWireFormat());

            IPrimitiveMap properties = msg.Properties;
            Assert.AreEqual(properties["stringProperty"], "string");
            Assert.AreEqual((byte)properties["byteProperty"], (byte) 1);
            Assert.AreEqual((short)properties["shortProperty"], (short) 1);
            Assert.AreEqual((int)properties["intProperty"], (int) 1);
            Assert.AreEqual((long)properties["longProperty"], (long) 1);
            Assert.AreEqual((float)properties["floatProperty"], 1.1f, 0);
            Assert.AreEqual((double)properties["doubleProperty"], 1.1, 0);
            Assert.AreEqual((bool)properties["booleanProperty"], true);
            Assert.IsNull(properties["nullProperty"]);
        }