Class PubSubHeaderMapper
java.lang.Object
com.google.cloud.spring.pubsub.integration.PubSubHeaderMapper
- All Implemented Interfaces:
org.springframework.integration.mapping.HeaderMapper<Map<String,String>>
public class PubSubHeaderMapper
extends Object
implements org.springframework.integration.mapping.HeaderMapper<Map<String,String>>
Maps headers from
PubsubMessages to Messages and vice-versa.
By default, filters out headers called "id", "timestamp", "gcp_pubsub_acknowledgement" or
"nativeHeaders" on the Message to PubsubMessage header conversion.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfromHeaders(org.springframework.messaging.MessageHeaders messageHeaders, Map<String, String> pubsubMessageHeaders) Generate headers inPubsubMessageformat fromMessageHeaders.voidsetInboundHeaderPatterns(String... inboundHeaderPatterns) Set the patterns of the headers to be mapped intoHeaders(Map).voidsetOutboundHeaderPatterns(String... outboundHeaderPatterns) Set the patterns of the headers to be mapped infromHeaders(MessageHeaders, Map).Generate headers inMessageformat fromMap<String, String>.
-
Constructor Details
-
PubSubHeaderMapper
public PubSubHeaderMapper()
-
-
Method Details
-
setOutboundHeaderPatterns
Set the patterns of the headers to be mapped infromHeaders(MessageHeaders, Map). First patterns take precedence.- Parameters:
outboundHeaderPatterns- header patterns to be mapped
-
setInboundHeaderPatterns
Set the patterns of the headers to be mapped intoHeaders(Map). First patterns take precedence.- Parameters:
inboundHeaderPatterns- header patterns to be mapped
-
fromHeaders
public void fromHeaders(org.springframework.messaging.MessageHeaders messageHeaders, Map<String, String> pubsubMessageHeaders) Generate headers inPubsubMessageformat fromMessageHeaders. All headers are converted into strings.Will map only the headers that match the patterns in
outboundHeaderPatternsMap. -
toHeaders
Generate headers inMessageformat fromMap<String, String>.Will map only the headers that match the patterns in
inboundHeaderPatternsMap.
-