internal virtual RoutingSettings <SqsTransport> BuildEndpointSQSRouting(
     RoutingSettings <SqsTransport> routing)
 {
     routing.RouteToEndpoint(typeof(PlaceOrder), "NSB.Server");
     routing.RegisterPublisher(typeof(OrderPlaced), "NSB.Server");
     routing.RegisterPublisher(typeof(BulkOrderPlaced), "NSB.Server");
     return(routing);
 }
        public void WhenPassingTransportAddressForPublisherInsteadOfEndpointName_UsingAssemblyAndNamespace_ShouldThrowException()
        {
            var routingSettings = new RoutingSettings <MessageDrivenTransportDefinition>(new SettingsHolder());

            var exception = Assert.Throws <ArgumentException>(() => routingSettings.RegisterPublisher(Assembly.GetExecutingAssembly(), nameof(EventNamespace), "EndpointName@MyHost"));

            Assert.AreEqual(expectedExceptionMessageForWrongEndpointName, exception.Message);
        }
        public void WhenPassingEndpointNameForPublisher_ShouldAddRouteToPublishers()
        {
            var routingSettings = new RoutingSettings <MessageDrivenTransportDefinition>(new SettingsHolder());

            routingSettings.RegisterPublisher(typeof(Event), "EndpointName");

            var publishers = ApplyPublisherRegistrations(routingSettings);

            var publishersForEvent = publishers.GetPublisherFor(typeof(Event)).SingleOrDefault();

            Assert.IsNotNull(publishersForEvent);
        }
        public void WhenPassingEndpointNameForPublisher_UsingAssemblyAndNamespace_ShouldAddEventsWithNamespaceToPublishers()
        {
            var routingSettings = new RoutingSettings <MessageDrivenTransportDefinition>(new SettingsHolder());

            routingSettings.RegisterPublisher(Assembly.GetExecutingAssembly(), nameof(EventNamespace), "EndpointName");

            var publishers = ApplyPublisherRegistrations(routingSettings);

            var publishersForEvent = publishers.GetPublisherFor(typeof(Event)).SingleOrDefault();
            var publishersForEventWithNamespace = publishers.GetPublisherFor(typeof(EventWithNamespace)).SingleOrDefault();

            Assert.IsNull(publishersForEvent);
            Assert.IsNotNull(publishersForEventWithNamespace);
        }
        public void Should_register_all_types_in_assembly_when_not_specifying_namespace()
        {
            var routingSettings = new RoutingSettings <MessageDrivenTransportDefinition>(new SettingsHolder());

            routingSettings.RegisterPublisher(Assembly.GetExecutingAssembly(), "someAddress");

            var publishers = ApplyPublisherRegistrations(routingSettings);

            var result1 = publishers.GetPublisherFor(typeof(BaseMessage)).SingleOrDefault();
            var result2 = publishers.GetPublisherFor(typeof(SubMessage)).SingleOrDefault();
            var result3 = publishers.GetPublisherFor(typeof(EventWithoutNamespace)).SingleOrDefault();
            var result4 = publishers.GetPublisherFor(typeof(IMessageInterface)).SingleOrDefault();

            Assert.IsNotNull(result1);
            Assert.IsNotNull(result2);
            Assert.IsNotNull(result3);
            Assert.IsNotNull(result4);
        }
Exemple #6
0
        public virtual RoutingSettings <SqlServerTransport> BuildEndpointRouting(
            RoutingSettings <SqlServerTransport> routing)
        {
            var routes = typeScanner.GetAllTypesWithPublishingEndpoints();

            foreach (var route in routes)
            {
                var assemblyType = route.Item1;
                var endpoint     = GetEndpointNameWithPrefixedEnvironment(GetEnvironmentName(), route.Item2);

                if (assemblyType.IsInterface)
                {
                    routing.RegisterPublisher(assemblyType, endpoint);
                }
                else if (assemblyType.IsClass && !assemblyType.IsAbstract)
                {
                    routing.RouteToEndpoint(assemblyType, endpoint);
                }
            }

            return(routing);
        }
 private void RegistraPublisher <T>(RoutingSettings <T> routingSettings) where T : TransportDefinition, IMessageDrivenSubscriptionTransport
 {
     routingSettings.RegisterPublisher(typeof(InseritaFirmaBolla).Assembly, endpointName);
 }
Exemple #8
0
 private void RegisterPublisherAndEndpoints(RoutingSettings <SqlServerTransport> routing)
 {
     routing.RegisterPublisher(typeof(AlterationFinishedEvent), "AlterationSenderEndPoint");
     routing.RegisterPublisher(typeof(OrderPaidEvent), "AlterationSenderEndPoint");
 }