Using Structured Data in the Solace JCSMP API

SDTs are structured, language-independent, and architecture-independent data types. SDTs can be used in messages to facilitate the exchange of binary data in a heterogeneous network that has clients that use different hardware architectures and programming languages.

The Solace JCSMP API supports the ability to carry structured data in the binary attachment of the message or as user-defined message header fields.

All structured data must be added to or read from complex data structures (maps and streams), generically called containers. Containers themselves are structured data types. Therefore, a map or stream can contain simple SDT types or other maps or streams.

Related Samples

  • For an example of how to work with SDTs when publishing and receiving messages, see the RequestReply samples (RRDirectRequester, RRDirectReplier, RRGuaranteedRequester, and RRGuaranteedReplier) in the Solace Developer Hub.
  • For an example of how to add SDT payloads to a message, see the SDTPubSubMsgIndep or SDTPubSubMsgDep samples in the Solace Developer Hub..

Supported Structured Data Types

The Solace JCSMP API supports the following SDTs.

Supported Structured Data Types

Data Type JCSMP 

Boolean

java.lang.Boolean

8-bit signed integer

java.lang.Byte

8-bit unsigned integer

Not applicable

16-bit signed integer

java.lang.Short

16-bit unsigned integer

Not applicable

32-bit signed integer

java.lang.Integer

32-bit unsigned integer

Not applicable

64-bit signed integer

java.lang.Long

64-bit unsigned integer

Not applicable

32-bit floating point

float

64-bit floating point

double

character (16-bit unicode)

java.lang.Character

byte array

byte[]

string (UTF-8 encoded)

java.lang.String

destination (Topic or Queue physical names)

com.solacesystems.
jcsmp.Destination

SMF message

com.solacesystems.
jcsmp.
RawSMFMessage

Map (a structured data container of a sequence of named fields. Each field must be one of the supported data types.)

SDTMap

Stream (a structured data container of a sequence of unnamed fields. Each field must be one of the supported data types.)

SDTStream

Unknown (a validly formatted but unrecognized data type)

com.solacesystems.
jcsmp.
SDTUnknownType

Null or unspecified

null

Structured Data Type Conversion

The table below lists how the supported SDTs in a received message can be read by the Solace JCSMP API.

Possible Data Type Conversions in JCSMP

  Read As
    Bool Byte Byte[ ] Char Dest Dbl Float Int Long Map Msg Short Stream String

Written As

Bool

 

 

 

 

 

 

 

 

 

 

 

 

Byte

 

 

 

 

 

 

 

 

 

Byte[ ]

 

 

 

 

 

 

 

 

 

 

 

 

 

Char

 

 

 

 

 

 

 

 

 

 

 

 

Dest

 

 

 

 

 

 

 

 

 

 

 

 

 

Dbl

 

 

 

 

 

 

 

 

 

 

 

 

Float

 

 

 

 

 

 

 

 

 

 

 

Int

 

2

 

 

 

 

 

 

 

2

 

Long

 

2

 

 

 

 

 

2

 

 

2

 

Map

 

 

 

 

 

 

 

 

 

 

 

 

 

Msg

 

 

 

 

 

 

 

 

 

 

 

 

 

Short

 

2

 

 

 

 

 

2

2

 

 

 

Stream

 

 

 

 

 

 

 

 

 

 

 

 

 

String

1

 

 

 

 

 

 

1. Returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignoring case, to the string “true”.

2. If a lossless conversion.