Inheritance: IMessageSerializer
Esempio n. 1
0
        public void FixtureSetup()
        {
            serializer = new XmlMessageSerializer();
            var serializationMessage = new MockMessageWithCollection(stringValue)
            {
                MockData = { IntValue = mockDataIntValue }
            };

            serializationMessage.AddData(new MockData { IntValue = 1 });
            serializationMessage.AddData(new MockData { IntValue = 2 });

            var xml = serializer.Serialize(serializationMessage);
            message = serializer.Deserialize(xml, typeof(MockMessageWithCollection)) as MockMessageWithCollection;
        }
Esempio n. 2
0
        public void Subscribe(string subscribingEndpointName)
        {
            var subscriptions = Config.SubscriptionSection.Section.Subscriptions;

            foreach (Config.SubscriptionElement subscription in subscriptions)
            {
                var subscriptionMessage = new SubscriptionMessage
                {
                    Endpoint = $"{subscribingEndpointName}@{Environment.MachineName}"
                };

                var destination = EndpointAddress.Parse(subscription.Endpoint);

                log.VerboseFormat("Subscribing to: {0}", destination);

                var serializer = new XmlMessageSerializer();
                var sendingChannel = SendingChannelResolver.GetChannel();
                sendingChannel.Send(destination, ChannelMessageFactory.CreateChannelMessage(subscriptionMessage, serializer));
            }
        }