-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Retrieving message headers uses the ServiceControl search API:
ServicePulse/src/ServicePulse.Host/app/js/services/services.service-control.js
Lines 117 to 124 in d373dc3
| function getMessageHeaders(messageId) { | |
| var url = uri.join(scConfig.service_control_url, 'messages', 'search', messageId); | |
| return $http.get(url).then(function(response) { | |
| return { | |
| data: response.data | |
| }; | |
| }); | |
| } |
The search API returns more than one message if they each contain the searched-for message id.
Previously, when headers were retrieved, only the first message returned was used:
ServicePulse/src/ServicePulse.Host/app/js/views/message/controller.js
Lines 58 to 60 in d373dc3
| serviceControlService.getMessageHeaders(message.message_id).then(function (msg) { | |
| message.messageHeaders = msg.data[0].headers; | |
| }, function () { |
This caused ServicePulse to display the incorrect headers for a given message, causing confusion.
Normally this wasn't a problem for a user, however in scenarios where the MessageFailed event was subscribed to, and itself fails, the original failed message and the MessageFailed event message could cause this scenario to happen. The MessageFailed event contains a property that indicates the id of the failed message, which is why it was returned in the search results and can be mistakenly used.
Details of change
In the search results, the correct message header is now displayed for each message.
Steps to reproduce
- Alter the ServiceControl events sample to turn on auditing in the EndpointsMonitor endpoint
- Run the sample
- This will attempt to process a SimpleMessage message, which will fail.
- The failed message will go to the error queue and will get picked up by ServiceControl
- ServiceControl will publish a MessageFailed event that contains the original message id in it's message body
- The EndpointsMonitor endpoint will process the MessageFailed event and send a copy to ServiceControl
- ServiceControl will read this audited message and add it to the database
- Now there are two messages in the database with the same Id but only one of them is the original failed message
- Open ServicePulse and navigate to the failed messages screen
- Find the failed message and open the headers tab.
- The wrong headers are displayed. If you followed the steps above, the easiest way to see this is that the message type is MessageFailed and not SimpleMessage.