🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

How to get a Map (java.util) of internal properties of a JCSMP message (in java)

pruffieux
pruffieux Member Posts: 14 ✭✭

When calling the
`dump()` method on a message (BytesXMLMessage, with JCSMP API), there are two
kind of information:

 1. metadata, which are internal headers (replicationGroupMessageId, traceId, messageId, etc…)

2. message body in binary format

 

I would like to know
if it's possible to get the internal properties in a Map structure (like the
one provided by the properties) in `msg.getProperties()`

For the moment I am parsing the dump() response but I would like to know if there's a better way to get these internal properties.

Tagged:

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin

    Hi @pruffieux,

    I think the getProperties() method might be what you're looking for?

    Hope that helps!

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin

    For #1 Metadata, there are actually two sub-sections:

    • Message headers
    • User Properties

    Unfortunately, there are no convenience functions to walk through every header in the message and provide it in a Map. You'll just have to crawl through all the get and is methods on the Message. That's what I did for this post from a few years ago:

    I should probably update it since (as you mentioned) there are new metadata available (RGMID, Trace Context, etc.)