1

I've recently upgradeed one of our solutions from MassTransit 2 to 3 and since the upgrade, we've noticed that MT 3 is appending an extra host information detail appended to the message payload (detail omitted):

{
    "messageId": "guid",
    "conversationId": "guid",
    "sourceAddress": "rabbitmq://rabbitserver/source",
    "destinationAddress": "rabbitmq://rabbitserver/destination",
    "messageType": [
        ...
    ],
    "message": {
        ...
    },
    "headers": {},
    "host": {
        "machineName": "...",
        "processName": "...",
        "processId": 1234,
        "assembly": "MassTransit",
        "assemblyVersion": "3.1.2.383",
        "frameworkVersion": "...",
        "massTransitVersion": "3.1.2.383",
        "operatingSystemVersion": "..."
    }
}

We'd like to suppress the host information from being added or to rename it as it's causing conflicts in our system.

I've looked at creating middleware as mentioned here: Adding values to header in MassTransit.RabbitMq but can't seem to get access to the data to removed it and after a quick look in the code from github, I can't see any option to not send the host info. Is there something I'm missing, or is there a way I can remove/rename this data when the message is published?

Community
  • 1
  • 1
Ian Cotterill
  • 1,667
  • 4
  • 18
  • 28
  • How is it conflicting? It's at a level above your message body. The short of it is adding the ability to turn it off would require a code change. – Chris Patterson Feb 02 '16 at 14:47
  • The issues is the messages are consumed by our monitoring which already expects a host to be a string rather than an object. Changing it would require a change across the board. It looks like the message is being added by the json serializer when the json message envelope is constructed - is it possible to replace the default json serializer/message envelope? – Ian Cotterill Feb 02 '16 at 14:55
  • But if the Host is a string in your message body it should still be a string in your message body. Can you post your message contract? – Chris Patterson Feb 03 '16 at 02:51
  • It's not masstransit or rabbit that are causing the problem, it's read by elasticsearch which is then setting up an index incorrectly. It can be worked around from that side, I was just hoping there was a way it could be suppressed from sending. – Ian Cotterill Feb 03 '16 at 10:23
  • Help me understand. Are you storing your message body in ES or the ConsumeContext (which includes the message)? It sounds like you have a way forward but I'd still like to understand how adding to the ConsumeContext affected your indexing in ES. We use ES as well, and we actually log the entire ConsumeContext so that we have the InitiatorId to be able to chain events together so I'm curious. – Chris Patterson Feb 03 '16 at 16:35
  • Sorry for the slow response - ES isn't naturally my area so wanted to have a bit more info before replying. We consume the event from the rabbit queue in it's entirety and then use logstash to format the message down as required - sometimes stripping the payload, sometimes not. Most of our monitoring producers will append a host string into the message so across our estate we're expecting host to be a string. When we find the object, it's causing the events to be dropped as our ES is expecting a string. We think we can sort it with logstash, but at the moment, we've not tried. – Ian Cotterill Feb 08 '16 at 11:19

0 Answers0