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
PubsubMessage
s to Message
s 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fromHeaders
(org.springframework.messaging.MessageHeaders messageHeaders, Map<String, String> pubsubMessageHeaders) Generate headers inPubsubMessage
format fromMessageHeaders
.void
setInboundHeaderPatterns
(String... inboundHeaderPatterns) Set the patterns of the headers to be mapped intoHeaders(Map)
.void
setOutboundHeaderPatterns
(String... outboundHeaderPatterns) Set the patterns of the headers to be mapped infromHeaders(MessageHeaders, Map)
.Generate headers inMessage
format 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 inPubsubMessage
format fromMessageHeaders
. All headers are converted into strings.Will map only the headers that match the patterns in
outboundHeaderPatternsMap
. -
toHeaders
Generate headers inMessage
format fromMap<String, String>
.Will map only the headers that match the patterns in
inboundHeaderPatternsMap
.
-