Ejemplo n.º 1
0
        /// <summary>
        /// Configures the serializer to use a custom namespace. (http://tempuri.net) is the default
        /// </summary>
        public XmlSerializationSettings Namespace(string namespaceToUse)
        {
            if (string.IsNullOrEmpty(namespaceToUse))
            {
                throw new ConfigurationErrorsException("Can't use a null or empty string as the xml namespace");
            }

            SettingsHolder.SetProperty <XmlMessageSerializer>(s => s.Namespace, namespaceToUse);

            return(this);
        }
        public void When_registered_registering_multiple_addresses_for_same_type_and_using_plainmessages_last_one_wins()
        {
            SettingsHolder.SetProperty <DefaultAutoSubscriptionStrategy>(s => s.SubscribePlainMessages, true);
            var baseType = typeof(BaseMessage);
            var router   = new StaticMessageRouter(Enumerable.Empty <Type>());
            var addressA = new Address("BaseMessage", "A");

            router.RegisterMessageRoute(baseType, addressA);
            var addressB = new Address("BaseMessage", "b");

            router.RegisterMessageRoute(baseType, addressB);

            Assert.AreEqual(1, router.GetDestinationFor(baseType).Count);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Turns on auto-subscriptions for messages not marked as commands. This was the default before v4
 /// </summary>
 public AutoSubscribeSettings AutoSubscribePlainMessages()
 {
     SettingsHolder.SetProperty <DefaultAutoSubscriptionStrategy>(c => c.SubscribePlainMessages, true);
     return(this);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Allows to endpoint to subscribe to messages owned by the local endpoint
 /// </summary>
 public AutoSubscribeSettings DoNotRequireExplicitRouting()
 {
     SettingsHolder.SetProperty <DefaultAutoSubscriptionStrategy>(c => c.DoNotRequireExplicitRouting, true);
     return(this);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Turns off auto subscriptions for sagas. Sagas where not auto subscribed by default before v4
 /// </summary>
 public AutoSubscribeSettings DoNotAutoSubscribeSagas()
 {
     SettingsHolder.SetProperty <DefaultAutoSubscriptionStrategy>(c => c.DoNotAutoSubscribeSagas, true);
     return(this);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Tells the serializer to sanitize the input data from illegal characters
        /// </summary>
        public XmlSerializationSettings SanitizeInput()
        {
            SettingsHolder.SetProperty <XmlMessageSerializer>(s => s.SanitizeInput, true);

            return(this);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Tells the serializer to not wrap properties which have either XDocument or XElement with a "PropertyName" element.
        /// By default the xml serializer serializes the following message
        /// </summary>
        /// <code>
        /// interface MyMessage { XDocument Property { get; set; } }
        /// </code>
        /// into the following structure
        /// <code>
        /// <MyMessage>
        ///     <Property>
        ///       ... Content of the XDocument
        ///     </Property>
        /// </MyMessage>
        /// </code>
        /// This flag allows to omit the property tag wrapping. Which results to
        /// <code>
        /// <MyMessage>
        ///       ... Content of the XDocument
        /// </MyMessage>
        /// </code>
        /// When this feature is enable the root element of the XDocument must match the name of the property. The following would not work and lead to deserialization error:
        /// <code>
        /// <MyMessage>
        ///       <Root>
        ///         ...
        ///       </Root>
        /// </MyMessage>
        /// </code>
        /// </param>
        public XmlSerializationSettings DontWrapRawXml()
        {
            SettingsHolder.SetProperty <XmlMessageSerializer>(s => s.SkipWrappingRawXml, true);

            return(this);
        }
Ejemplo n.º 8
0
 public SystemXmlSerializationSettings WrapSingleMessage()
 {
     SettingsHolder.SetProperty <SystemXmlMessageSerializer>(s => s.SkipWrappingElementForSingleMessages, false);
     return(this);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Controls how many messages should be read from the queue at once
        /// </summary>
        /// <param name="config"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static Configure BatchSize(this Configure config, int value)
        {
            SettingsHolder.SetProperty <AzureMessageQueueReceiver>(t => t.BatchSize, value);

            return(config);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Controls how long messages should be invisible to other callers when receiving messages from the queue
        /// </summary>
        /// <param name="config"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static Configure MessageInvisibleTime(this Configure config, int value)
        {
            SettingsHolder.SetProperty <AzureMessageQueueReceiver>(t => t.MessageInvisibleTime, value);

            return(config);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Sets the maximum amount of time, in milliseconds, that the queue will wait before checking for a new message
        /// </summary>
        /// <param name="config"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static Configure MaximumWaitTimeWhenIdle(this Configure config, int value)
        {
            SettingsHolder.SetProperty <AzureMessageQueueReceiver>(t => t.MaximumWaitTimeWhenIdle, value);

            return(config);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Sets the amount of time, in milliseconds, to add to the time to wait before checking for a new message
        /// </summary>
        /// <param name="config"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static Configure PeekInterval(this Configure config, int value)
        {
            SettingsHolder.SetProperty <AzureMessageQueueReceiver>(t => t.PeekInterval, value);

            return(config);
        }