This demo contains the following end-to-end examples for the MicroService.Harness.
- WebPage integration for the Producer API.
- WPF desktop application for the Consumer.
- Clone the repository.
- Edit
Webpage/microservice-api.html
. - Update the API url on
line 148
with the Protocol, IP Address and Port configured in the MicroService.Harness ReadMe. - Open
MassTransit.Message.Broker/MassTransit.Message.Broker.sln
in Visual Studio. - Edit
C:\git\MicroService.Harness.Demo\MassTransit.Message.Broker\Resources\Settings\Connection.resx
. - Update the HostName value with the IP Address for the
eth0
adapter of your WSL Ubuntu host, installed during the MicroService.Harness ReadMe. (Runifconfig
in the bash terminal to get the IP). - Update the Password with the unencrypted
Broker
password configured in theGenerate RabbitMQ password hashes
section of the MicroService.Harness ReadMe.
Important
The credentials are intended for local development only. Take care to avoid committing passwords into public and/or shared repositories and follow recommended practices for securely implementing a password store in a real world application.
- Open
Webpage/microservice-api.html
in your browser. - Fill in and submit the form.
- A POST request will be sent to the producer API and the response written to the page.
- Open
MassTransit.Message.Broker/MassTransit.Message.Broker.sln
in Visual Studio. - Debug the startup project.
- Fill in the form in the side panel.
- Click one of the submission methods below the form in the side panel.
- A request will be sent to the consumer and the payload and response written to the text boxes on the page.
- You can see the different ways of sending a request by opening
MassTransit.Message.Broker\ViewModels\MainWindowViewModel.cs
and looking at the methods in thePrivate Methods
region.
Note
The Publish
and Send
methods do not subscribe to the exchange for a response and can be debugged by adding breakpoints to the consumer in the MicroService.Harness. The Send/Receive methods do subscribe and the response will include the result from the service.