示例#1
0
        public MyAppRegistry()
        {
            Transports.LightweightListenerAt(2222);

            Publish.Message <Message1>();
            Publish.Message <Message2>();
            Publish.Message <Message3>();

            Subscribe.At("tcp://server1:2222");
            Subscribe.To <Message4>();
            Subscribe.To <Message5>();
        }
示例#2
0
        public MyAppRegistry()
        {
            Http.UseKestrel().UseUrls("http://localhost:3001");

            Transports.Lightweight.ListenOnPort(2222);

            Publish.Message <Message1>();
            Publish.Message <Message2>();
            Publish.Message <Message3>();

            Subscribe.At("tcp://server1:2222");
            Subscribe.To <Message4>();
            Subscribe.To <Message5>();
        }
示例#3
0
        public MyMessagingApp()
        {
            // Configure handler policies
            Handlers.DefaultMaximumAttempts = 3;
            Handlers.OnException <SqlException>().RetryLater(3.Seconds());

            // Declare published messages
            Publish.Message <Message1>().To("tcp://server1:2222");

            // Register to receive messages
            Subscribe.At("tcp://loadbalancer1:2233");
            Subscribe.To <Message2>();
            Subscribe.To(type => type.IsInNamespace("MyMessagingApp.Incoming"));

            // Configure the built in transports
            Transports.LightweightListenerAt(2233);
        }
示例#4
0
        public PublisherApp()
        {
            // Opt into the Consul backed subscriptions
            // using the default Consul configuration
            Include <ConsulBackedSubscriptions>();

            Transports.Lightweight.ListenOnPort(2211);

            // 100% Optional for diagnostics
            Publish.Message <NewUser>();
            Publish.Message <DeleteUser>();

            // Assume that all concrete types in your application
            // in your application assembly that implement a marker
            // interface are published by the application
            // NOTE: IPublished is just an example and does not exist in Jasper
            Publish.MessagesMatching(x => x.CanBeCastTo <IPublished>());

            // This would be the Uri to the load balancer
            Subscribe.At("tcp://localhost:2211");
            Subscribe.ToAllMessages();
        }
示例#5
0
        public LocalApp()
        {
            // Explicitly set the logical descriptive
            // name of this application. The default is
            // derived from the name of the class
            ServiceName = "MyApplication";

            // Incoming messages
            Transports.ListenForMessagesFrom("tcp://localhost:2333");

            // *Optionally* make the subscriptions to the location of the load
            // balancer in front of your logical application nodes
            Subscribe.At("tcp://loadbalancer:2333");

            // Declare subscriptions to specific message types
            Subscribe
            .To <OtherAppMessage1>()
            .To <OtherAppMessage2>()
            .To <OtherAppMessage3>();

            // Or just quickly say, "send me everything that
            // I understand how to handle"
            Subscribe.ToAllMessages();
        }