You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/service-bus-messaging/build-message-driven-apps-nservicebus.md
+22-25Lines changed: 22 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,10 +32,10 @@ The sample assumes you've [created an Azure Service Bus namespace](service-bus-q
32
32
The following diagram, generated by [ServiceInsight](https://particular.net/serviceinsight), a visualization and debugging tool from Particular Software, shows the message flow:
33
33
34
34
:::image type="content" source="./media/nservicebus/sequence-diagram.png" alt-text="Image showing the sequence diagram":::
35
-
1. Open `SendReceiveWithNservicebus.sln` in your favorite code editor (For example, Visual Studio 2019).
35
+
1. Open `SendReceiveWithNservicebus.sln` in your favorite code editor (For example, Visual Studio 2022).
36
36
1. Open `appsettings.json` in both the Receiver and Sender projects and set `AzureServiceBusConnectionString` to the connection string for your Azure Service Bus namespace.
37
-
38
-
37
+
- This can be found in the Azure portal under **Service Bus Namespace** > **Settings** > **Shared access policies** > **RootManageSharedAccessKey** > **Primary Connection String** .
38
+
- The `AzureServiceBusTransport` also has a constructor that accepts a namespace and token credential, which in a production environment will be more secure, however for the purposes of this tutorial the shared access key connection string will be used.
39
39
40
40
## Define the shared message contracts
41
41
@@ -86,14 +86,15 @@ var host = Host.CreateDefaultBuilder(args)
@@ -204,11 +203,10 @@ Let's ignore the commented code for now; we'll get back to it later when we talk
204
203
205
204
The class implements `IHandleMessages<Ping>`, which defines one method: `Handle`. This interface tells NServiceBus that when the endpoint receives a message of type `Ping`, it should be processed by the `Handle` method in this handler. The `Handle` method takes the message itself as a parameter, and an `IMessageHandlerContext`, which allows further messaging operations, such as replying, sending commands, or publishing events.
206
205
207
-
Our `PingHandler` is straightforward: when a `Ping` message is received, log the message details and reply back to the sender with a new `Pong` message.
206
+
Our `PingHandler` is straightforward: when a `Ping` message is received, log the message details and reply back to the sender with a new `Pong` message, which is subsequently handled in the Sender's `PongHandler`.
208
207
209
208
> [!NOTE]
210
209
> In the Sender's configuration, you specified that `Ping` messages should be routed to the Receiver. NServiceBus adds metadata to the messages indicating, among other things, the origin of the message. This is why you don't need to specify any routing data for the `Pong` reply message; it's automatically routed back to its origin: the Sender.
211
-
>
212
210
213
211
With the Sender and Receiver both properly configured, you can now run the solution.
214
212
@@ -301,21 +299,20 @@ Next, it's time to figure out where to deploy our solution in Azure.
301
299
In this sample, the Sender and Receiver endpoints are configured to run as console applications. They can also be hosted in various Azure services including Azure Functions, Azure App Services, Azure Container Instances, Azure Kubernetes Services, and Azure VMs. For example, here's how the Sender endpoint can be configured to run as an Azure Function:
0 commit comments