Top Description Fields Constructors Methods
org.springframework.jms.support

public Class SimpleJmsHeaderMapper

extends AbstractHeaderMapper<Message>
implements JmsHeaderMapper
Class Inheritance
All Implemented Interfaces
org.springframework.jms.support.JmsHeaderMapper, org.springframework.messaging.support.HeaderMapper
Imports
java.util.Enumeration, .HashMap, .Map, .Set, jakarta.jms.Destination, .JMSException, .Message, org.springframework.messaging.MessageHeaders, org.springframework.messaging.support.AbstractHeaderMapper, org.springframework.util.StringUtils

Simple implementation of JmsHeaderMapper.

This implementation copies JMS API headers (e.g. JMSReplyTo) to and from Messages. Any user-defined properties will also be copied from a JMS Message to a Message, and any other headers on a Message (beyond the JMS API headers) will likewise be copied to a JMS Message. Those other headers will be copied to the general properties of a JMS Message whereas the JMS API headers are passed to the appropriate setter methods (e.g. setJMSReplyTo).

Constants for the JMS API headers are defined in JmsHeaders. Note that most of the JMS headers are read-only: the JMSDestination, JMSDeliveryMode, JMSExpiration, JMSMessageID, JMSPriority, JMSRedelivered and JMSTimestamp flags are only copied from a JMS Message. Those values will not be passed along from a Message to an outbound JMS Message.

Authors
Mark Fisher, Gary Russell, Stephane Nicoll
Since
4.1

Field Summary

Modifier and TypeField and Description
private static final Set<Class<?>>
Inherited from org.springframework.messaging.support.AbstractHeaderMapper:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String
fromHeaderName(String headerName)

Overrides org.springframework.messaging.support.AbstractHeaderMapper.fromHeaderName.

Add the outbound prefix if necessary.

public void
fromHeaders(MessageHeaders
the abstracted MessageHeaders
headers
,
Message
the native target message
jmsMessage
)

Implements org.springframework.messaging.support.HeaderMapper.fromHeaders.

Map from the given MessageHeaders to the specified target message.

protected String
toHeaderName(String propertyName)

Overrides org.springframework.messaging.support.AbstractHeaderMapper.toHeaderName.

Add the inbound prefix if necessary.

public MessageHeaders
toHeaders(Message
the native target message
jmsMessage
)

Implements org.springframework.messaging.support.HeaderMapper.toHeaders.

Map from the given target message to abstracted MessageHeaders.

Inherited from org.springframework.messaging.support.AbstractHeaderMapper:
getHeaderIfAvailablesetInboundPrefixsetOutboundPrefix

Field Detail

SUPPORTED_PROPERTY_TYPESback to summary
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES

Constructor Detail

SimpleJmsHeaderMapperback to summary
public SimpleJmsHeaderMapper()

Method Detail

fromHeaderNameback to summary
protected String fromHeaderName(String headerName)

Overrides org.springframework.messaging.support.AbstractHeaderMapper.fromHeaderName.

Add the outbound prefix if necessary.

Convert MessageHeaders#CONTENT_TYPE to content_type for JMS compliance.

Annotations
@Override
See Also
CONTENT_TYPE_PROPERTY
fromHeadersback to summary
public void fromHeaders(MessageHeaders headers, Message jmsMessage)

Implements org.springframework.messaging.support.HeaderMapper.fromHeaders.

Doc from org.springframework.messaging.support.HeaderMapper.fromHeaders.

Map from the given MessageHeaders to the specified target message.

Parameters
headers:MessageHeaders

the abstracted MessageHeaders

jmsMessage:Message

the native target message

Annotations
@Override
toHeaderNameback to summary
protected String toHeaderName(String propertyName)

Overrides org.springframework.messaging.support.AbstractHeaderMapper.toHeaderName.

Add the inbound prefix if necessary.

Convert the JMS-compliant content_type to MessageHeaders#CONTENT_TYPE.

Annotations
@Override
See Also
CONTENT_TYPE_PROPERTY
toHeadersback to summary
public MessageHeaders toHeaders(Message jmsMessage)

Implements org.springframework.messaging.support.HeaderMapper.toHeaders.

Doc from org.springframework.messaging.support.HeaderMapper.toHeaders.

Map from the given target message to abstracted MessageHeaders.

Parameters
jmsMessage:Message

the native target message

Returns:MessageHeaders

the abstracted MessageHeaders

Annotations
@Override