Beispiel #1
0
        /// <summary>
        /// Maps a specific message type to a concrete message type. The transport will automatically map the most concrete type to a topic.
        /// In case a subscriber needs to subscribe to a type up in the message inheritance chain a custom mapping needs to be defined.
        /// </summary>
        public static void MapEvent(this TransportExtensions <SqsTransport> transportExtensions, Type subscribedEventType, Type publishedEventType)
        {
            Guard.AgainstNull(nameof(subscribedEventType), subscribedEventType);
            Guard.AgainstNull(nameof(publishedEventType), publishedEventType);

            var settings = transportExtensions.GetSettings();

            if (!settings.TryGet <EventToEventsMappings>(out var mappings))
            {
                mappings = new EventToEventsMappings();
                settings.Set(mappings);
            }

            mappings.Add(subscribedEventType, publishedEventType);
        }
        public void SetUp()
        {
            sqsClient = new MockSqsClient();
            snsClient = new MockSnsClient();
            sqsClient.EnableGetAttributeReturnsWhatWasSet();
            settings = new SettingsHolder();

            customEventToTopicsMappings = new EventToTopicsMappings();
            settings.Set(customEventToTopicsMappings);

            customEventToEventsMappings = new EventToEventsMappings();
            settings.Set(customEventToEventsMappings);

            messageMetadataRegistry = settings.SetupMessageMetadataRegistry();
            queueName = "fakeQueue";

            manager = CreateNonBatchingSubscriptionManager();
        }