public class JacksonPubSubMessageConverter extends Object implements PubSubMessageConverter
| Constructor and Description |
|---|
JacksonPubSubMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
fromPubSubMessage(com.google.pubsub.v1.PubsubMessage message,
Class<T> payloadType)
Convert the payload of a given
PubsubMessage to a desired Java type. |
com.google.pubsub.v1.PubsubMessage |
toPubSubMessage(Object payload,
Map<String,String> headers)
Create a
PubsubMessage given an object for the payload and a map of headers. |
public JacksonPubSubMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper - the object mapper used to create and read JSON.public com.google.pubsub.v1.PubsubMessage toPubSubMessage(Object payload, Map<String,String> headers)
PubSubMessageConverterPubsubMessage given an object for the payload and a map of headers.toPubSubMessage in interface PubSubMessageConverterpayload - the object to place into the message payloadheaders - the headers of the messagepublic <T> T fromPubSubMessage(com.google.pubsub.v1.PubsubMessage message,
Class<T> payloadType)
PubSubMessageConverterPubsubMessage to a desired Java type.fromPubSubMessage in interface PubSubMessageConverterT - the type of the payloadmessage - the message containing the payload of the objectpayloadType - the desired type of the objectCopyright © 2020 Pivotal Software, Inc.. All rights reserved.