Configuring Message Headers

In general, the source message header is propagated through the Micro-Integration to the target message header. When you configure the Micro-Integration, you can optionally configure mappings for the header information between the external system and the PubSub+event broker service.

If you want to map the source message header to a target message header, you do so using the Target Header Mappings step when you create a Micro-Integration or modify them after.

To specify the mappings, you must use the Spring Expression Language (SpEL). For examples to use SpEL expressions, see SpEL Examples for Target Header Mappings.

It's important to recognize that there are a set of common source and target message headers that you can use that are available for all Micro-Integration Types as well as specific message headers depending on the Micro-Integration Type you are using. For information about the message headers that are available, see:

SpEL Examples for Target Header Mappings

The following are examples that show how to use a SpEL expression in the fields for the Target Header Mappings step when you create a mapping between the source message header and the target message header. To fully utilize the mappings, you should have a good understanding of how to use SpEL expressions. For example, to access the header attributes or payload, you use the headers properties.

For more information about using Spring Expression Language (SpEL) expressions, see Spring Expression Language (SpEL). The following are how you would perform some header mapping operations:

  • On the Target Header Mappings step, enter the following values to the following fields to map the Solace Correlation ID to the JMS correlation ID:
    • Target Header Name:jms_correlationId
    • Header Expressionheaders.solace_correlationId
  • On the Target Header Mappings step, enter the following values to map the to the following fields header ID with custom prefix called myprefix- to a custom header name called custom-message-id:

    • Target Header Namecustom-message-id
    • Header Expression'myprefix-' + headers.id

Common Reserved Message Headers

The following are reserved header spaces that are common to configure all Micro-Integrations:

Any headers with these prefixes (that are not defined by the Micro-Integration or any technology used by the Micro-Integration) may not be backwards compatible in future releases of this Micro-Integration.

Common and Vendor-Specific Dynamic Producer Destinations

To route messages to dynamic destinations at runtime, use the Configuring Message Headers described above to set the following headers. The following table contains both common and vendor-specific dynamic producer destinations.

Header Name Type Values Applies To Description

scst_targetDestination

string

Any valid destination name

Solace (PubSub+)

JMS

IBM MQ

Amazon SQS

Google Cloud Pub/Sub

MQTT

Specifies the name of the dynamic destination to publish to. Setting this header overrides the configured destination.

solace_scst_targetDestinationType

string

(queue|topic)

Solace

Amazon SQS

Google Cloud Pub/Sub

Specifies the destination type of the dynamic destination. When unspecified, the configured or default destination type is used.

solace_connector_scst_targetDestinationType

string

(queue|topic)

JMS

IBM MQ

Specifies the destination type of the dynamic destination. When unspecified, the configured or default destination type is used.

gcp_pubsub_topic

string

Any valid destination name

Google Cloud Pub/Sub

Specifies the name of the dynamic destination to publish to. Setting this header overrides the configured destination.

Amazon SNS Message Headers

To configure the common message headers for this Micro-Integration, see the following sections: 

Amazon SQS Message Headers

To configure the common message headers for this Micro-Integration, see the following sections: 

Azure Service Bus Message Headers

You can configure Azure Service Bus vendor-specific message headers using the following lists: 

Dynamic Headers for Azure Service Bus

Azure Service Bus supports Azure Service Bus partitioning and message sessions of the Azure Service Bus by setting the following headers:

Header Name Type Access Description

azure_session_id

string

Read

Sets a session ID of a message in the message header.

azure_partition_key

string

Read

Sets a partition key in the message header.

The session ID has higher priority than the partition key. When both azure_partition_key and azure_session_id headers are set, the value of the session ID overwrites the value of the partition key.

To configure the common message headers for this Micro-Integration, see the following sections: 

Google Cloud Pub/Sub Message Headers

You can configure Google Cloud Pub/Sub vendor-specific message headers using the following lists:

Message Header Mappings for Google Cloud Pub/Sub

The following Google Cloud Pub/Sub  PubsubMessage attributes are mapped to the following message properties: 

Header Name Type Access Description

gcp_pubsub_message_id

string

Read

The ID of the message, assigned by the Google Cloud Pub/Sub service when the message is published. See Google Cloud Pub/Sub PubsubMessage.getMessageId().

gcp_pubsub_publish_time

long(seconds)

Read

The time at which the message was published, populated by the Google Cloud Pub/Sub service when it receives the Publish call.

See Google Cloud Pub/Sub PubsubMessage.getPublishTime().

gcp_pubsub_ordering_key

string

Read

The Google Cloud Pub/Sub message’s ordering key. See Google Cloud Pub/Sub PubsubMessage.getOrderingKey().

The following Solace message headers marked with Read access are automatically forwarded to Google Cloud Pub/Sub messages, while headers with Write access can be set using transformations.

Header Name Type Access Description

solace_applicationMessageId

string

Read/Write

The application provided message ID.

solace_applicationMessageType

string

Read/Write

The application provided message type. This value is used by applications only.

solace_correlationId

string

Read/Write

The correlation ID for the message.

solace_dmqEligible boolean Write Set the Solace message’s dmqEligible header.
solace_expiration long Write Set the time at which the Solace message is set to expire.
solace_priority int Write Set the Solace message’s priority.
solace_senderId string Read The Sender ID for the Solace message.
solace_senderTimestamp long Read The time at which the Solace message was published.
solace_sequenceNumber string Read The application-defined sequence number set on the Solace message.

Reserved Message Headers for Google Cloud Pub/Sub

The following is a reserved header space that can be used with Google Cloud Pub/Sub:

  • gcp_pubsub|goog

To configure the common message headers for this Micro-Integration, see the following sections: 

IBM MQ Message Headers

You can configure IBM MQ vendor-specific message headers using the following lists:

JMS Message Headers

You can use the following message headers to get and set JMS message properties for IBM MQ.

 

Header Name Type Access Description

jms_correlationId

String

Read/Write

The correlation ID for the message.

jms_deliveryMode

int

Read

The delivery mode value specified for this message.

jms_destination

jakarta.jms.Destination

Read

The destination to which the message is being sent.

jms_expiration

long

Read

The time at which the JMS message is set to expire.

jms_messageId

String

Read

A value that uniquely identifies each message sent by a provider.

jms_priority

int

Read/Write

Specifies the message’s priority set on the send.

When header is absent, JMS message is sent with default priority of 4.

jms_redelivered

boolean

Read

An indication of whether this message is being redelivered.

jms_replyTo

jakarta.jms.Destination

Read/Write

The Destination object to which a reply to this message should be sent.

jms_timestamp

long

Read

The time a message was handed off to a provider to be sent.

jms_timeToLive

long

Write

Specifies the message’s time to live set on the send.

When header is absent, JMS message is sent with default timeToLive of 0 (zero means that a message never expires).

jms_type

String

Read/Write

The message type identifier supplied by the client when the message was sent.

JMS Binder Headers

The following are JMS Binder Headers.

 

Header Name Type Access Description

jms_scst_nullPayload

boolean

Read

Specifies when the JMS message payload is null.

Two cases exist:

  • A JMS TextMessage with no message payload is received: The payload is converted to an empty String, and the jms_scst_nullPayload header is added.

  • A JMS Message with no message payload is received: The payload is converted to an empty byte array, and the jms_scst_nullPayload header is added.

Reserved Message Headers for IBM MQ

The following is a reserved header space that can be used with IBM MQ:

  • jms_|JMS_|JMSX

To configure the common message headers for this Micro-Integration, see the following sections: 

Solace Message Headers

Solace headers exposed to the Micro-Integration are documented in the Spring Cloud Stream Binder for Solace PubSub+ documentation.