{"id":27881,"date":"2019-12-25T00:00:00","date_gmt":"2019-12-24T23:00:00","guid":{"rendered":"https:\/\/blexin.com\/orchestrare-gli-eventi-con-rebus\/"},"modified":"2021-05-21T20:30:32","modified_gmt":"2021-05-21T18:30:32","slug":"orchestrate-events-with-rebus","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/","title":{"rendered":"Orchestrate events with Rebus"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"27858\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-00-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-00\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=300%2C178&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-27858\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the\u00a0<a href=\"https:\/\/blexin.com\/en\/blog-en\/lets-solve-the-rebus-of-communication\/\" target=\"_blank\" rel=\"noreferrer noopener\">previous article<\/a>, we saw how the use of a service bus could\u00a0benefit software systems where the decoupling between their parts is necessary. In particular, we have seen how to do that with Rebus.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rebus makes available a very interesting feature: the ability to orchestrate processes with a long duration (long-running process), and whose evolution is not sequential but based on the unleashing of events.<br>For this type of process, in literature, we can find the&nbsp;<a href=\"https:\/\/www.enterpriseintegrationpatterns.com\/patterns\/messaging\/ProcessManager.html\" target=\"_blank\" rel=\"noreferrer noopener\">Process Manager Pattern<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"334\" height=\"179\" data-attachment-id=\"27861\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-1-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-1-2.png?fit=334%2C179&amp;ssl=1\" data-orig-size=\"334,179\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1-2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-1-2.png?fit=300%2C161&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-1-2.png?fit=334%2C179&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-1-2.png?resize=334%2C179&#038;ssl=1\" alt=\"\" class=\"wp-image-27861\" srcset=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-1-2.png?w=334&amp;ssl=1 334w, https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-1-2.png?resize=300%2C161&amp;ssl=1 300w\" sizes=\"auto, (max-width: 334px) 100vw, 334px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The process manager is triggered by an event (trigger message)&nbsp;and acts as a central control unit managing the status of the sequence of steps of the process and deciding the actions to be taken based on intermediate results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With Rebus, it is possible to model such scenarios as it provides the so-called&nbsp;<strong>Sagas<\/strong>. Saga is just another name for Process Manager, and so a saga is nothing but the implementation of a state machine whose transitions between states are determined by messages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To achieve this implementation, we need:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A representation of the state of the saga<\/li><li>A particular handler that represents a model of the transitions and actions that constitute the saga itself<\/li><li>A mapping between the message fields and those representing the status of the saga.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A concrete example is the best way to understand these aspects better. To show the use of the sagas, I imagine a simple use case: the purchase of a product.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have a client&nbsp;<strong>(Order Client<\/strong>) by which a user can choose a product to order and confirm the purchase. The purchase confirmation involves a payment service (<strong>PaymentService<\/strong>). The product acquisition process ends when a third service,&nbsp;<strong>OrderHandler<\/strong>, that receives information about the order and payment confirmation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"567\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-2-2.png?resize=1024%2C567&#038;ssl=1\" alt=\"\" class=\"wp-image-27863\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-2-2-1024x567.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-2-2-980x543.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-2-2-480x266.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s start with OrderClient.<br>Its implementation does not differ much from the&nbsp;<em>Sender<\/em>&nbsp;seen in the previous article.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nusing (var activator = new BuiltinHandlerActivator())\n{\n\u00a0\u00a0\u00a0var sagaDbConnectionString = ConfigurationManager.ConnectionStrings&#x5B;&quot;SagasDB&quot;].ToString();\n\u00a0\u00a0\u00a0var bus = Configure.With(activator)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Transport(t = &gt; t.UseMsmqAsOneWayClient())\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Subscriptions(s =&gt; s.StoreInSqlServer(sagaDbConnectionString, &quot;SubscriptionsTable&quot;, isCentralized: true))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Start();\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This time we add to the bus configurations also the one that allows a publisher to store the subscriptions to the events published by it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, we choose to store subscriptions with SQL Server (don&#8217;t forget to add the&nbsp;<em>Rebus.SqlServer<\/em>&nbsp;package to the Solution) and to use centralized storage to make it in common to both the publisher and its subscribers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the configuration is completed, OrderClient just publishes messages on the bus depending on the user inputs. Two types of messages will be published:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>bus.Publish (new Order (orderId, orderType)). Wait ();<br>Where&nbsp;<em>orderId<\/em>&nbsp;is a randomly generated integer (we will understand its importance later) and orderType is a string that represents the type of order.<\/li><li>bus.Publish (new OrderConfirmation (orderId, confirmation)). Wait ();<br>If the user chooses to confirm the order, this message is sent with the same orderId and with the&nbsp;<em>confirmation<\/em>&nbsp;parameter, a boolean that brings with it the user&#8217;s choice to confirm or not the order.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"281\" data-attachment-id=\"27866\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-3-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-3-2.png?fit=942%2C281&amp;ssl=1\" data-orig-size=\"942,281\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-3-2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-3-2.png?fit=300%2C89&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-3-2.png?fit=942%2C281&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-3-2.png?resize=942%2C281&#038;ssl=1\" alt=\"\" class=\"wp-image-27866\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-3-2.png 942w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-3-2-480x143.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 942px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">From the log, it is also possible to see that the message of type&nbsp;<em>Order<\/em>&nbsp;is addressed to&nbsp;<em>OrderHandler<\/em>&nbsp;and the message of type&nbsp;<em>OrderConfirmation<\/em>&nbsp;to&nbsp;<em>PaymentService<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The implementation of the PaymentService is also very simple.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nnamespace PaymentService\n{\n\u00a0\u00a0\u00a0\u00a0class Program\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0static void Main(string&#x5B;] args)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0using (var activator = new BuiltinHandlerActivator())\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var db = ConfigurationManager.ConnectionStrings&#x5B;&quot;SagasDB&quot;].ToString();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0activator.Register((bus, context) =&gt; new Handler(bus));\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Configure.With(activator)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Transport(t =&gt; t.UseMsmq(&quot;PaymentService&quot;))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Subscriptions(s =&gt; s.StoreInSqlServer(db, &quot;SubscriptionsTable&quot;, isCentralized: true))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Start();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0activator.Bus.Subscribe &lt;OrderConfirmation&gt;().Wait();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot;Press &#x5B;enter] to exit.&quot;);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.ReadLine();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\n\u00a0\u00a0\u00a0\u00a0class Handler : IHandleMessages &lt;OrderConfirmation&gt;\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0readonly IBus _bus;\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public Handler(IBus bus)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_bus = bus;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public async Task Handle(OrderConfirmation message)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (message.Confirmation)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot;Payment accepted&quot;);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var payment = true;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0_bus.Publish(new OrderPayment(message.Id, payment)).Wait();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Once we configure the bus, we subscribe to messages of type OrderConfirmation. The&nbsp;<em>handler<\/em>&nbsp;of these messages also publishes an&nbsp;<em>OrderPayment<\/em>&nbsp;message to which&nbsp;<em>OrderHandler<\/em>&nbsp;will be subscribed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"255\" data-attachment-id=\"27869\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-4-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-4-2.png?fit=956%2C255&amp;ssl=1\" data-orig-size=\"956,255\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-4-2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-4-2.png?fit=300%2C80&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-4-2.png?fit=956%2C255&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-4-2.png?resize=956%2C255&#038;ssl=1\" alt=\"\" class=\"wp-image-27869\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-4-2.png 956w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-4-2-480x128.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 956px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, we arrive to the most interesting part, as&nbsp;<em>OrderHandler<\/em>&nbsp;will contain the implementation of the saga.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nnamespace OrderHandler\n{\n\u00a0\u00a0\u00a0\u00a0class Program\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0static void Main(string&#x5B;] args)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var sagaDbConnectionString = ConfigurationManager.ConnectionStrings&#x5B;&quot;SagasDB&quot;].ToString();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0using (var activator = new BuiltinHandlerActivator())\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0activator.Register((bus, context) =&gt; new DemoSaga(bus));\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Configure.With(activator)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Subscriptions(s =&gt; s.StoreInSqlServer(sagaDbConnectionString, &quot;SubscriptionsTable&quot;, isCentralized: true))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Sagas(s =&gt; s.StoreInSqlServer(sagaDbConnectionString, &quot;Sagas&quot;, &quot;SagaIndex&quot;))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Transport(t =&gt; t.UseMsmq(&quot;OrderHandler&quot;))\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.Start();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0activator.Bus.Subscribe &lt;Order&gt;().Wait();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0activator.Bus.Subscribe &lt;OrderPayment&gt;().Wait();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(&quot;Press ENTER to quit&quot;);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.ReadLine();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We added a further configuration of the bus where we are going to set where the information of the saga will be saved.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nSagas(s =&gt; s.StoreInSqlServer(sagaDbConnectionString, &quot;Sagas&quot;, &quot;SagaIndex&quot;))\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Then we subscribe to OrderHandler messages of type Order and&nbsp;<em>OrderPayment<\/em>.<br>But how is the&nbsp;<em>DemoSaga<\/em>&nbsp;handler made?<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\u00a0\u00a0\u00a0class DemoSaga : Saga &lt;DemoSagaData&gt;,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0IAmInitiatedBy &lt;Order&gt;, IAmInitiatedBy &lt;OrderPayment&gt;\n\u00a0\u00a0\u00a0\u00a0{\n...\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In his statement, we see that DemoSaga implements the abstract class&nbsp;<em>Saga,<\/em>&nbsp;which is made concrete by the definition of the type&nbsp;<em>DemoSagaData.<\/em><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nclass DemoSagaData : ISagaData\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public Guid Id { get; set ; }\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public int Revision { get; set; }\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public int OrderId { get; set; }\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public string OrderType { get; set; }\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public bool OrderReceived { get; set; }\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public bool PaymentReceived { get; set; }\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public bool Complete()\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return OrderReceived &amp;&amp; PaymentReceived;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">DemoSagaData implements the ISagaData interface. In this way, we are going to represent the state of the saga.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Moreover, in the declaration, we see that DemoSaga also implements&nbsp;<em>IAmInitiatedBy&lt;TMessage&gt;<\/em>&nbsp;an interface that allows indicating&nbsp;to a handler of messages which types are allowed to start a new saga.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nprotected override void\nCorrelateMessages(ICorrelationConfig&lt;DemoSagaData&gt; config)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0config.Correlate&lt;Order&gt;(m =&gt; m.Id, d =&gt; d.OrderId);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0config.Correlate&lt;OrderPayment&gt; (m =&gt; m.Id, d =&gt; d.OrderId);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We make the override of the CorrelateMessages method (ICorrelationConfig&lt;TSagaData&gt; config), which allows us to correlate incoming messages with the status of the saga to avoid having multiple instances of the saga. In this example, we used ordered as the correlation ID between messages and saga.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public async Task Handle(Order message)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (!IsNew) return;\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Data.OrderType = message.Type;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Data.OrderReceived = true;\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(@&quot;\nOrder Received -&gt; Type: &quot; + message.Type);\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0await CompleteSaga();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public async Task Handle(OrderPayment message)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (IsNew) return;\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Data.PaymentReceived = message.Payment;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(@&quot;\nPayment Received!\n&quot;);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0await CompleteSaga();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0async Task CompleteSaga()\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (Data.Complete())\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine(@&quot;\nOrder Complete\n&quot;);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MarkAsComplete();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Then we implement the Handle() methods for the two incoming messages. The use of&nbsp;<em>IsNew<\/em>, a parameter of the abstract class&nbsp;<em>Saga<\/em>, allows us to verify if we are using a new saga. Therefore, once again, we are going to guarantee that we are using a single instance of the saga for the current&nbsp;<em>orderId<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After saving the information received from the messages in the status of the saga, the&nbsp;<em>CompleteSaga ()<\/em>&nbsp;method is called which verifies if we have received the order and if the payment was successful. If the outcome of the order is positive, the&nbsp;<em>MarkAsComplete ()<\/em>&nbsp;method is invoked, which establishes the end of the saga by going to delete the related information from the chosen storage.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"638\" height=\"371\" data-attachment-id=\"27873\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-5-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-5-2.png?fit=638%2C371&amp;ssl=1\" data-orig-size=\"638,371\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-5-2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-5-2.png?fit=300%2C174&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-5-2.png?fit=638%2C371&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-5-2.png?resize=638%2C371&#038;ssl=1\" alt=\"\" class=\"wp-image-27873\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-5-2.png 638w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-5-2-480x279.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 638px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the image, there are the&nbsp;<em>Sagas<\/em>&nbsp;and&nbsp;<em>SagaIndex<\/em>&nbsp;tables whose data will be removed upon completion of the saga, and we also show the&nbsp;<em>SubscriptionTable<\/em>&nbsp;table where messages with their subscribers are mapped.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"423\" data-attachment-id=\"27875\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-6-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-6-2.png?fit=881%2C423&amp;ssl=1\" data-orig-size=\"881,423\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-6-2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-6-2.png?fit=300%2C144&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-6-2.png?fit=881%2C423&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-6-2.png?resize=881%2C423&#038;ssl=1\" alt=\"\" class=\"wp-image-27875\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-6-2.png 881w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image-6-2-480x230.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 881px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I hope this article has intrigued you as it was for me to discuss this topic. I leave the link of the repository where you can find the implementation of the example in the&nbsp;<em>sagas branch<\/em>(<a href=\"https:\/\/github.com\/intersect88\/RebusDemo\/tree\/sagas\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;https:\/\/github.com\/intersect88\/RebusDemo\/tree\/sagas&nbsp;<\/a>).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To the next article.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let the saga continue&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"454\" data-attachment-id=\"27888\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/attachment\/image-7-en\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN.png?fit=1089%2C483&amp;ssl=1\" data-orig-size=\"1089,483\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-7-EN\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN.png?fit=300%2C133&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN.png?fit=1024%2C454&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN-1024x454.png?resize=1024%2C454&#038;ssl=1\" alt=\"\" class=\"wp-image-27888\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN-1024x454.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN-980x435.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2019\/12\/image-7-EN-480x213.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s discover how Rebus, besides abstracting from transport, let us managing processes based on bus messages<\/p>\n","protected":false},"author":196716251,"featured_media":27858,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_crdt_document":"","inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false},"categories":[688637524],"tags":[688637384,688637454,688637537],"class_list":["post-27881","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-c-en","tag-rebus-en","tag-swdesign-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Orchestrate events with Rebus - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Orchestrate events with Rebus - Blexin\" \/>\n<meta property=\"og:description\" content=\"Let&#039;s discover how Rebus, besides abstracting from transport, let us managing processes based on bus messages\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-24T23:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-21T18:30:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Genny Paudice\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Genny Paudice\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/\"},\"author\":{\"name\":\"Genny Paudice\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\"},\"headline\":\"Orchestrate events with Rebus\",\"datePublished\":\"2019-12-24T23:00:00+00:00\",\"dateModified\":\"2021-05-21T18:30:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/\"},\"wordCount\":974,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image-00.png?fit=1024%2C608&ssl=1\",\"keywords\":[\"C#\",\"Rebus\",\"softwaredesign\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/\",\"name\":\"Orchestrate events with Rebus - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image-00.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2019-12-24T23:00:00+00:00\",\"dateModified\":\"2021-05-21T18:30:32+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image-00.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image-00.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/orchestrate-events-with-rebus\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Orchestrate events with Rebus\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\",\"name\":\"Genny Paudice\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"caption\":\"Genny Paudice\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/genny-paudiceblexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Orchestrate events with Rebus - Blexin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/","og_locale":"en_US","og_type":"article","og_title":"Orchestrate events with Rebus - Blexin","og_description":"Let's discover how Rebus, besides abstracting from transport, let us managing processes based on bus messages","og_url":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/","og_site_name":"Blexin","article_published_time":"2019-12-24T23:00:00+00:00","article_modified_time":"2021-05-21T18:30:32+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Genny Paudice","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Genny Paudice","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/"},"author":{"name":"Genny Paudice","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973"},"headline":"Orchestrate events with Rebus","datePublished":"2019-12-24T23:00:00+00:00","dateModified":"2021-05-21T18:30:32+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/"},"wordCount":974,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1","keywords":["C#","Rebus","softwaredesign"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/","url":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/","name":"Orchestrate events with Rebus - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1","datePublished":"2019-12-24T23:00:00+00:00","dateModified":"2021-05-21T18:30:32+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/orchestrate-events-with-rebus\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Orchestrate events with Rebus"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973","name":"Genny Paudice","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","caption":"Genny Paudice"},"url":"https:\/\/blexin.com\/en\/author\/genny-paudiceblexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image-00.png?fit=1024%2C608&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-7fH","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/27881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716251"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=27881"}],"version-history":[{"count":8,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/27881\/revisions"}],"predecessor-version":[{"id":32714,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/27881\/revisions\/32714"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/27858"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=27881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=27881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=27881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}