public OtherApp() { Handlers.Discovery(x => x.DisableConventionalDiscovery().IncludeType <OtherGuyMessages>()); ServiceName = "Other"; Publish.Message <Increment>().To("tcp://localhost:4444"); }
public BusRegistry() { var uri = "durable://localhost:2110/servicebus_example"; Publish.Message <MiddlewareMessage>().To(uri); Publish.Message <AMessageThatWillError>().To(uri); }
public DurableTransportApp() { // Nevermind, just disable it altogether Transports.Durable.Disable(); // Set up a listener (this is optional) Transports.Durable.ListenOnPort(4000); // Throw away messages faster because the default is 100 // attempts Transports.Durable.MaximumSendAttempts(100); // Configure the maximum number of threads dedicated to processing // messages being received by queue. 5 is the default Transports.Durable.DefaultQueue.MaximumParallelization(5); Transports.Durable.Queue("important").MaximumParallelization(10); Transports.Durable.Queue("lowpriority").MaximumParallelization(3); Transports.Durable.Queue("control").Sequential(); // Or, listen by Uri // This directs Jasper to listen for messages at port 2200 // with the durable transport Transports.ListenForMessagesFrom("durable://localhost:2200"); // Registering a subscription to Message1 that should be // delivered to a load balancer Uri at port 2200 and the "important" // queue Subscribe.To <Message1>().At("durable://loadbalancer:2200/important"); // Publish the message Message2 to the DNS entry "remoteserver" Publish.Message <Message2>().To("durable://remoteserver:2201"); }
public StaticRoutingApp(AppSettings settings) { // Explicitly add a single message type Publish.Message <PingMessage>() .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); }
public LoopbackTransportApp() { // TODO -- talk about how to configure worker queues // Publish the message Message2 the important queue Publish.Message <Message2>().To("loopback://important"); }
public WarehouseApp(int senderPort) { var receiverPort = senderPort + 1; Include <MartenBackedPersistence>(); Settings.Alter <StoreOptions>(_ => { _.Connection(ConnectionSource.ConnectionString); }); //Note: whether or not our event is destined for a durable queue, it will be stored durably in the outbox because of the implementation of the handlers. Publish.Message <ItemOutOfStock>().To($"tcp://localhost:{senderPort}/durable"); Transports.DurableListenerAt(receiverPort); Settings.Alter <StoreOptions>(_ => { _.Connection(ConnectionSource.ConnectionString); _.DatabaseSchemaName = "warehouse"; }); Handlers.DisableConventionalDiscovery(); Handlers.IncludeType <THandler>(); }
public SenderApp() { Settings.MartenConnectionStringIs(ConnectionSource.ConnectionString); Include <MartenBackedPersistence>(); Publish.Message <ScheduledMessage>().To("tcp://localhost:2777"); }
public MyAppRegistry() { Transports.LightweightListenerAt(2222); Publish.Message <Message1>(); Publish.Message <Message2>(); Publish.Message <Message3>(); }
public OutboxSender(MessageTracker tracker) { Handlers.DisableConventionalDiscovery().IncludeType <CascadeReceiver>(); Services.AddSingleton(tracker); Publish.Message <TriggerMessage>().To("durable://localhost:2337"); Transports.DurableListenerAt(2338); Settings.PersistMessagesWithSqlServer(ConnectionSource.ConnectionString, "outbox_sender"); }
public LoopbackTransportApp() { Processing.Worker("important") .IsDurable() .MaximumParallelization(10); // Publish the message Message2 the important queue Publish.Message <Message2>().To("loopback://important"); }
public PingApp(SampleSettings settings) { // Configuring PingApp to send PingMessage's // to the PongApp Publish.Message <PingMessage>() .To(settings.Pinger); // Listen for incoming messages from "Pinger" Transports.ListenForMessagesFrom(settings.Pinger); }
public BusRegistry() { var uri = "durable://localhost:2110/servicebus_example"; Publish.Message <MiddlewareMessage>().To(uri); Publish.Message <AMessageThatWillError>().To(uri); Logging.UseConsoleLogging = true; Logging.LogTransportEventsWith <ConsoleTransportLogger>(); }
public SenderApp() { Settings.MartenConnectionStringIs(ConnectionSource.ConnectionString); Include <MartenBackedPersistence>(); Logging.UseConsoleLogging = true; Publish.Message <DelayedMessage>().To("tcp://localhost:2777"); }
public ItemSender() { Settings.PersistMessagesWithSqlServer(ConnectionSource.ConnectionString, "sender"); Publish.Message <ItemCreated>().To("tcp://localhost:2345/durable"); Publish.Message <Question>().To("tcp://localhost:2345/durable"); Transports.LightweightListenerAt(2567); }
public ItemSender() { Include <MartenBackedPersistence>(); Publish.Message <ItemCreated>().To("tcp://localhost:2345/durable"); Settings.Alter <StoreOptions>(_ => { _.Connection(ConnectionSource.ConnectionString); _.DatabaseSchemaName = "sender"; }); }
public LightweightTransportApp() { // Set up a listener (this is optional) Transports.LightweightListenerAt(4000); // Or do the exact same thing by supplying a Uri Transports.ListenForMessagesFrom("tcp://localhost:4000"); // Publish the message Message2 to the DNS entry "remoteserver" Publish.Message <Message2>().To("tcp://remoteserver:2201"); }
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>(); }
public LoopbackTransportApp() { // Configure the maximum number of threads dedicated to processing // messages being received by queue. 5 is the default Transports.Loopback.DefaultQueue.MaximumParallelization(5); Transports.Loopback.Queue("important").MaximumParallelization(10); Transports.Loopback.Queue("lowpriority").MaximumParallelization(3); Transports.Loopback.Queue("control").Sequential(); // Publish the message Message2 the important queue Publish.Message <Message2>().To("loopback://important"); }
public Sender1() { Services.Scan(_ => { _.TheCallingAssembly(); _.WithDefaultConventions(); }); Transports.LightweightListenerAt(2222); Publish.Message <Ping>().To("tcp://localhost:2233"); }
public MyMessagingApp() { // Configure handler policies Handlers.Retries.MaximumAttempts = 3; Handlers.Retries.Add(x => x.Handle <SqlException>().Reschedule(3.Seconds())); // Declare published messages Publish.Message <Message1>().To("tcp://server1:2222"); // Configure the built in transports Transports.LightweightListenerAt(2233); }
public MyMessagingApp() { // Configure handler policies Handlers.DefaultMaximumAttempts = 3; Handlers.OnException <SqlException>().RetryLater(3.Seconds()); // Declare published messages Publish.Message <Message1>().To("tcp://server1:2222"); // Configure the built in transports Transports.LightweightListenerAt(2233); }
public StatusMessageSendingApp() { // Any time StatusMessage is published, // set the deliver within limit on the outgoing Envelope Publish.Message <StatusMessage>() .Customize(envelope => envelope.DeliverWithin(10.Seconds())); // Use a criteria against the message type to say // that all messages contained in the "MyApp.Status" namespace // would be published with the deliver within rule Publish.MessagesFromNamespace("MyApp.Status") .Customize(envelope => envelope.DeliverWithin(10.Seconds())); }
public OutboxSampleApp() { Include <MartenBackedPersistence>(); Settings.Alter <StoreOptions>(_ => { _.Connection("Host=localhost;Port=5432;Database=postgres;Username=postgres;password=postgres"); }); Publish.Message <UserCreated>(); Publish.Message <UserDeleted>(); Publish.AllMessagesTo("tcp://localhost:22222/durable"); }
public SenderApp() { Handlers.DisableConventionalDiscovery(); Publish.Message <TraceMessage>().To(ReceiverApp.Listener); Settings.PersistMessagesWithSqlServer(Servers.SqlServerConnectionString, "sender"); Settings.Alter <MessagingSettings>(_ => { _.ScheduledJobs.PollingTime = 1.Seconds(); _.ScheduledJobs.FirstExecution = 0.Seconds(); }); }
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>(); }
public ItemSender() { Include <MartenBackedPersistence>(); Publish.Message <ItemCreated>().To("tcp://localhost:2345/durable"); Publish.Message <Question>().To("tcp://localhost:2345/durable"); Settings.Alter <StoreOptions>(_ => { _.Connection(Servers.PostgresConnectionString); _.DatabaseSchemaName = "sender"; }); Transports.LightweightListenerAt(2567); }
public OutboxSender(MessageTracker tracker) { Handlers.DisableConventionalDiscovery().IncludeType <CascadeReceiver>(); Services.AddSingleton(tracker); Publish.Message <TriggerMessage>().To("durable://localhost:2337"); Transports.DurableListenerAt(2338); Settings.ConfigureMarten(marten => { marten.Connection(ConnectionSource.ConnectionString); marten.DatabaseSchemaName = "outbox_sender"; }); Include <MartenBackedPersistence>(); }
public OrdersApp() { Include <MartenBackedPersistence>(); // Whether or not our event is destined for a durable queue, it will be stored durably in the outbox because of the usage of an outbox when sending it. Publish.Message <OrderPlaced>().To("tcp://localhost:2345/durable"); Transports.LightweightListenerAt(5432); Settings.Alter <StoreOptions>(_ => { _.Connection(ConnectionSource.ConnectionString); }); Handlers.DisableConventionalDiscovery(); Handlers.IncludeType <OrderStatusHandler>(); }
public WarehouseApp() { Include <MartenBackedPersistence>(); Settings.Alter <StoreOptions>(_ => { _.Connection(ConnectionSource.ConnectionString); }); //Note: whether or not our event is destined for a durable queue, it will be stored durably in the outbox because of the implementation of the handlers. Publish.Message <ItemOutOfStock>().To("tcp://localhost:5432/"); Transports.DurableListenerAt(2345); Handlers.DisableConventionalDiscovery(); Handlers.IncludeType <THandler>(); }
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); }