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: 959 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: 634 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.)