示例#1
0
        public StaticRoutingApp(AppSettings settings)
        {
            // Explicitly add a single message type
            Publish.Message <PingMessage>()
            .To(settings.Transactions);

            // Publish any types matching the supplied filter
            // to this channel
            Publish.MessagesMatching("Message suffix", type => type.Name.EndsWith("Message"))
            .To(settings.Transactions);

            // Publish any message type contained in the assembly
            // to this channel, by supplying a type contained
            // within that assembly
            Publish.MessagesFromAssemblyContaining <PingMessage>()
            .To(settings.Transactions);

            // Publish any message type contained in the named
            // assembly to this channel
            Publish.MessagesFromAssembly(Assembly.Load(new AssemblyName("MyMessageLibrary")))
            .To(settings.Transactions);

            // Publish any message type contained in the
            // namespace given to this channel
            Publish.MessagesFromNamespace("MyMessageLibrary")
            .To(settings.Transactions);

            // Publish any message type contained in the namespace
            // of the type to this channel
            Publish.MessagesFromNamespaceContaining <PingMessage>()
            .To(settings.Transactions);
        }