How to unmarshal when you don't know what you're unmarshalling?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to unmarshal when you don't know what you're unmarshalling?

Ron Cecchini
Hey, all.

I have a route that's sitting on a port and it can receive 1 of 2 different XML messages.

I was simply going to try to unmarshal with the first one, and if it errors, unmarshal with the next one.

But is there a smarter or best practices way to handle this?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: How to unmarshal when you don't know what you're unmarshalling?

Michael Davis
Can you get the sender to specify which type of file it is using a particular topic or message header or something?

Michael Davis

´╗┐On 2019-06-21, 5:29 PM, "Ron Cecchini" <[hidden email]> wrote:

    Hey, all.
   
    I have a route that's sitting on a port and it can receive 1 of 2 different XML messages.
   
    I was simply going to try to unmarshal with the first one, and if it errors, unmarshal with the next one.
   
    But is there a smarter or best practices way to handle this?
   
    Thanks.